Xcode is generally pretty great. All the templates are minimal, and you get a hello world application out of the box. However, when it comes to teaching iOS, we often find ourselves needlessly repeating things like “delete the default view controller” and guiding users through the steps of organizing and rearranging their app code. Generally, we really like to follow the same conventions that have been battle proven in the web realm.
One such practice we follow, is organizing the folders as follows:
- Assets: fonts, images, audio files and other media belong here
- Config: for all things related to application configuration or constants that are reused
- Controllers: Even though Apple would have you follow an MVVC pattern, we still like to split things up and adhere to MVC wherever possible
- Helpers: Simple classes or structs, usually with static methods for quick utilities or extensions.
- Models: All things related to data belong here. CoreData config, Model abstracts, validation classes, etc.
- Views: The storyboards, nibs, and custom view classes that relate to presentation and layout.
Our solution to this is a simple starter template that you can clone and start working from. It’s basically the same code that you get from creating a new, single-view application, but it save some steps. All you have to do is rename the app, let Xcode do the find and replace on it’s own, and you are off to the races!