I am starting a new project today from scratch using Swift and MVVM architecture. I would like to setup the files & folders structure for the best practice I can for easy and understandable navigation and usage.
Most tutorials suggest:
├─ Models
├─ Views
├─ ViewModels
├─ Stores
├─ Helpers
But I find it very lacking as I don't really know what would be the best practice to manage the ViewModels
folder.
Any good suggestions from real world super maintainable projects?
Thanks a lot! :)
To show only files with a changed source-control status, click the Source Control icon. Xcode provides templates for the common types of files you might want to add to your project, such as Swift files or playgrounds. In the Project navigator, select the folder or group where you want to add a file and perform one of the following actions:
If a group is associated with a folder, Xcode performs all rename, delete, move, and copy operations on the folder in the file system. For projects under source control, Xcode uses the source-control system to perform the operations and track the changes.
After you create the Xcode project ( use Single View App template ), you will find there is a subfolder in the project navigator, the subfolder name is the same as the project name.
A group is a collection of resources in your project. By default, Xcode maps each group to a folder in your project directory, but you can also create groups without an underlying file-system folder. You might use groups without folders if you want to manage files in your project without changing the underlying organization of the files on disk.
According to uncle Bob's Clean Architecture pattern, you may divide your code in 3 Layers :
Presentation : All Code which is Framework ( Cocoa here ) dependant. So Put your Views, ViewModels, Vierwcontrollers, etc.
Data : All the code interacting with repositories ( Like Network Calls, DB calls, User Defaults, etc )
Domain : All your Models
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With