iOS Development – Organizing Code for iOS App Development

code-organizationiosobjective cproject-structurexcode

I've been developing an app for the iOS platform, and as I've been going along, I've noticed that I've done a terrible job of keeping my files (.h, .m, .mm) organized. Is there any industry standards or best practices when it comes to organizing files for an iOS project?

My files include custom classes (beside the view controllers), customized View Controllers, third-party content, code that works only on iOS 5.0+ and code that works on previous versions. What I'm looking for is a solution to keep things organized in a manner that others (or myself in years to come) can look at this and understand the basic structure of the application and not get lost in the multiple files found therein.

Best Answer

There is no industry standard as such. You could look into sample Apple Source Projects to see how they do it..

You could however, try organizing your files into Groups & associate each group to a folder..

  • Organize all Controllers in One Group with Subgroup for each usecase.
  • Put all views in One Group and subgroup for each usecase.
  • Organize All Models in one Group
  • Put Third Party Libraries in Another Group with Subgroup for each Lib.

So on and So Forth.. Also, associate each group to a folder inside your project.

Related Topic