In tutorials and examples that provide code samples, sometimes I see that project files in the Xcode's Project navigator are arranged by groups following the MVC pattern ("Views", "Controllers", "Model"), and other times they are organized into groups by functionality ("Login", "Checklist", for instance).
Concerning iOS, is there any Apple's convention/recommendation for this? Which should be the best practice?
Developers organise their groups, code, and files many ways. But I use something like the following:
CoreData: Contains DataModel and Entity Classes.
Extension: Contain One class(default apple class extensions+project class extensions.)
Helper: Contain Third Party classes/Frameworks (eg. SWRevealController) + Bridging classes (eg. Obj C class in Swift based project)
Model: Make a singleton class (eg.AppModel - NSArray,NSDictionary, String etc.) for saving data. The Web Service Response parsing and storing data is also done here.
Services: Contain Web Service processes (eg. Login Verification, HTTP Request/Response)
View: Contain storyboard, LaunchScreen.XIB and View Classes. Make a sub folder Cells - contain UITableViewCell, UICollectionViewCell etc.
Controller: Contain Logic or Code related to UIElements (eg. UIButton’s reference+ clicked action) It could be replaced by ViewModel if MVVM is employed.
This structure is from another Stack Overflow post.
These may also help you: