itsaboutcode
itsaboutcode

Reputation: 25109

Is there any best practices or conventions for ios project structure

I was wondering if there is any best practices or conventions to structure your iOS projects?

Thanks.

Upvotes: 21

Views: 17338

Answers (5)

Randika Vishman
Randika Vishman

Reputation: 8134

I've been using a similar one to the following for my projects.

But after going through this thread and some other articles online, I decided to categorize few types under a new folder code UI.

  • Application (Config file with constants, AppDelegate)
  • Models
  • UI
    • Views
    • Controllers
    • If I use Nib files (.Xib) they should come under this or else the storyboard(s)
  • Resources (All resources like Images, Custom fonts, Audio files with each in different subfolders)
  • Services
  • Helpers/Utilities
  • Libraries

But if you are using MVVM architecture, please customize this to your best fit.

Cheers!

Upvotes: 1

Alvin George
Alvin George

Reputation: 14292

We follow a standard project structure so as the team can understand in a better way.

enter image description here

Upvotes: 0

daneejela
daneejela

Reputation: 14243

Although I agree that most common practice is to have files grouped by types (i.e. ViewControllers, Models etc.), I would add that there are some business cases where it is more useful to organize code by provided functionality. For example if you work for company that offers multiple combination of services, usually packed into different apps that share some of elements, for example - AddressBook, Messages, Document Management, etc...

In my projects I usually have a folder called Common where I put things that I reuse often, like datetime helpers, IO writers etc... Other things I separate by functionality.

Upvotes: 0

Vitaly Kotivskyi
Vitaly Kotivskyi

Reputation: 51

As for me, Architecting iOS Project solution works perfectly. I also added Cocoapods.

Now my project looks like:

enter image description here

Upvotes: 4

Christian Orth
Christian Orth

Reputation: 4673

Taken from iOS Coding Best Practices Slideshare from Jean-Luc David:

enter image description here

Upvotes: 9

Related Questions