Best practice for Xcode project team structure?

In tutorials and examples that provide code examples, sometimes I see that project files in the Xcode project navigator are organized by groups according to the MVC pattern ("Views", "Controllers", "Model"), and in other cases they are organized by functionality groups (e.g., Login, Checklist).

As for iOS, is there an Apple agreement / recommendation for this? What should be the best practice?

+5
source share
2 answers

I think many of them follow the many ways to organize their group, code, and files. I follow almost this: (Taken from this: How do you structure your iPhone Xcode project? )

CoreData: contains the DataModel and Entity classes.

Extension: Contains one class (default Java class extensions + project class extensions.)

Helper: Contains third-party / Framework classes (e.g. SWRevealController) + Bridge classes (e.g. Obj C class in a Swift-based project)

Model. Create a singleton class (e.g. AppModel - NSArray, NSDictionary, String, etc.) to save the data. It also parses and stores web service data.

Services: Contains web service processes (e.g. login check, HTTP request / response)

View: Contains the storyboard, LaunchScreen.XIB, and View Classes. Creating a subfolder Cells - contain UITableViewCell, UICollectionViewCell, etc.

Controller: contains logic or code related to UIElements (e.g. link to UIButtons + clicked action)

It may also help you:

+5
source

I really created a project to demonstrate what I consider to be my go-to Xcode design framework for a small or medium code base. You can find it here .

Here is his diagram:

  • Source - all source code
    • Account - classes associated with the account (classes related to the session, account logic, etc.)
    • Application - classes associated with the application. Application delegate, configuration classes, etc.
    • Key Extras - Extensions and Subclasses Associated with apple Classes
      • Utilities are general utility classes. Useful extensions, formatting utilities, convenience classes, etc.
      • Folders with Element elements - folder for UIView, UITableViewCell, etc.
    • Local save - local save level. All interactions with the local database (region, master data)
      • Repositories - all local logical constants associated with the model
    • Constants are all constants. URLs, fonts, colors, errors, etc.
    • Models - all models (server-side view). We will also introduce any object mapping logic here.
    • Modules Here we can find every part of the application divided by functionality
      • Folders based on the module. Each folder contains all view controllers, views, delegates, and related classes.
    • Networking - The network level of the application (for example, classes responsible for interacting with web services)
      • Services - Everything Associated with a Web Logic Model
  • Storyboard - contains all the storyboard files
  • Resources - any additional resources, such as media, documents, localization files, etc.
0
source

Source: https://habr.com/ru/post/1257934/


All Articles