How do You structure an iPhone Xcode project?

Viewed 18253

What are good ways of building groups/folders?

I've tried by feature (UI for a feature plus model etc) with a common group. I've also tried by UI, model, etc.

The former keeps like things together which fits the iPhone paradigm nicely. The latter means I jump around a bit more.

What do you think?

3 Answers

Organizing code by type

Organizing code by type is ok for small projects but it's not a good practice for big ones.

Just imagine you have tons of files and folders organized by type, and when you work on a single feature, you have to open all of the folders. Which can confuse you and you can get lost many times while you scroll through files.

It looks something like on A.G's & Julian B.'s answers.

Organizing code by feature (intent)

Organizing code by feature (intent) is the best practice for big projects and big teams.

Cause usually teams work on a single feature, and they focus only on a single folder or group of files. They don't necessarily have to know about other features and files.

It looks something like this:

  • AppDelegate
  • Features
    • Feature 1
      • View Controllers
      • Models
      • Views
      • Logic
    • Feature 2
      • View Controllers
      • Models
      • Views
      • Logic
  • Networking
    • Models
    • Logic
    • Extensions
  • Resources

Also, to mention, this practice and technique (organizing project by feature) are implemented by the greatest companies around the world.

Related