dev-resources.site
for different kinds of informations.
MVVM directory structure for larger project
Published at
1/15/2025
Categories
swift
architecture
Author
pheak_pheasa
Author
12 person written this
pheak_pheasa
open
Key Additions:
1. Modularization: Break the app into separate modules (e.g., UserModule, ProductModule) to improve scalability and collaboration in large teams.
2. DependencyInjection: Using DI frameworks (like Swinject) to handle dependencies across the app, improving testability and flexibility.
3. Managers: More specific app-wide managers like PushNotificationManager, AnalyticsManager for cross-functional management.
4. Tests: Better structured tests with different types of testing (e.g., unit tests, UI tests, integration tests).
5. Documentation: More extensive documentation covering architecture, APIs, and other design considerations.
MyApp/
β
βββ Models/ # Data models representing app entities
β βββ User.swift
β βββ Product.swift
β βββ ...
β
βββ Views/ # UI components (Views)
β βββ MainView.swift
β βββ UserView.swift
β βββ ProductView.swift
β βββ ...
β
βββ ViewModels/ # ViewModels responsible for data-binding and logic
β βββ MainViewModel.swift
β βββ UserViewModel.swift
β βββ ProductViewModel.swift
β βββ ...
β
βββ Services/ # Layer for API calls, data handling, etc.
β βββ NetworkService.swift
β βββ AuthService.swift
β βββ ImageService.swift
β βββ ...
β
βββ Persistence/ # Local data storage, CoreData, SQLite, etc.
β βββ CoreDataManager.swift
β βββ DatabaseMigration.swift
β βββ PersistenceService.swift
β
βββ Helpers/ # Reusable utilities or helper methods
β βββ Extensions/
β βββ DateFormatterHelper.swift
β βββ NetworkingHelper.swift
β βββ ...
β
βββ Resources/ # Images, JSON, etc.
β βββ Images/
β βββ Localizations/
β βββ Fonts/
β βββ ...
β
βββ Supporting Files/ # Configurations, AppDelegate, SceneDelegate, etc.
β βββ AppDelegate.swift
β βββ SceneDelegate.swift
β βββ Info.plist
β βββ Assets.xcassets
β
βββ UI/ # UI-specific components (e.g., custom buttons, loaders)
β βββ CustomButton.swift
β βββ LoadingIndicator.swift
β βββ CustomView.swift
β βββ ...
β
βββ Coordinators/ # Responsible for navigation flow
β βββ MainCoordinator.swift
β βββ UserCoordinator.swift
β βββ FlowCoordinator.swift
β
βββ Network/ # Network layer, handling API calls, caching, etc.
β βββ APIClient.swift
β βββ APIConstants.swift
β βββ ResponseHandler.swift
β βββ ...
β
βββ Managers/ # Handles app-wide management logic
β βββ SessionManager.swift
β βββ PushNotificationManager.swift
β βββ AnalyticsManager.swift
β
βββ Utils/ # Miscellaneous utilities
β βββ AppUtils.swift
β βββ Logging.swift
β
βββ Modularization/ # For large projects, consider splitting into modules
β βββ UserModule/ # Example of separate feature module
β β βββ UserModels/
β β βββ UserViews/
β β βββ UserViewModels/
β β βββ UserServices/
β β βββ UserCoordinator.swift
β βββ ProductModule/ # Another example
β βββ ProductModels/
β βββ ProductViews/
β βββ ProductViewModels/
β βββ ProductServices/
β βββ ProductCoordinator.swift
β
βββ DependencyInjection/ # Dependency Injection setup (e.g., using Swinject)
β βββ DIContainer.swift
β βββ ServicesAssembly.swift
β βββ ViewModelsAssembly.swift
β
βββ Tests/ # Unit and UI tests
β βββ ViewModelsTests/
β βββ ServicesTests/
β βββ PersistenceTests/
β βββ UITests/
β βββ ...
β
βββ Documentation/ # Project-related documentation
βββ README.md
βββ API_Documentation.md
βββ Architecture.md
swift Article's
30 articles in total
MVVM directory structure for larger project
currently reading
What Do All iOS Engineers Keep Forgetting?
read article
Mastering 4 way Infinite Scroll in SwiftUI!
read article
iOS Background Modes: A Quick Guide
read article
Debugging in Xcode: Tips to Save Your Time π οΈ
read article
I created a cool SwiftUI library!
read article
Optimizing iOS App Performance
read article
The Ultimate Guide to iOS Development: Closures (Part 7)
read article
Boost Your Appβs Performance with Lazy Stacks in SwiftUI
read article
The Ultimate Guide to iOS Development: Collections (Part 6)
read article
Access Control Levels in Swift
read article
Meet swift-api-client
read article
The Ultimate Guide to iOS Development: Functions (Part 5)
read article
Unlocking Face ID Integration: Boost Security and User Experience π
read article
Unlocking Business Growth with iOS Development Services
read article
MVC vs MVVM: A Real-Life iOS Interview Insight
read article
The Ultimate Guide to iOS Development: Control Flow (Part 4)
read article
Swift: A Journey into Open Source Excellence
read article
Object-Oriented Programming inΒ Swift
read article
A Drum machine for iOS
read article
The Ultimate Guide to iOS Development: Variables, Data Types, and Basic Operations in Swift (Part 3)
read article
The Ultimate Guide to iOS Development: From Programming Basics to Building Your First App (Part 2)
read article
Top 5 iOS App Templates to Kickstart Your Next Project
read article
The Ultimate Guide to iOS Development: From Programming Basics to Building Your First App (Part 1)
read article
Cosmos is hiring a senior iOS eng
read article
How To Add Multiple Modules In The Swift Package Manager
read article
Enhance Debugging in Swift with #file, #line, and #function
read article
Directly store value using "if expression" - Swift
read article
Day 3: Mull It Over | Advent of Code 2024 | Swift | δΈζ
read article
Property Wrappers in Swift: From Basics to Advanced Techniques
read article
Featured ones: