11 January, 2016
To better organized my code, I have been changing my project structure along the years. I think I've finally set with one, so time to record it for the future!
There are two basic guidelines when creating a project structure. First, keep it simple. Second, use something that makes sense to you.
- View Controllers
- View Models
- UI (aka storyboards)
If you have small projects, this structure will work fine. But when you start adding more files to it it becomes confusing. I rather organize files in a functional way, separating them by areas and layers of the app. So it ends up something more like this:
- Local Storage
- Classes that don't fit anywhere else
Inside those folders I usually follow the first setup, separating files by Views, ViewControllers, etc. This way you have almost every file related to an area of the app in one folder. All my images are stored in XCAssets. Fonts and other raw files are in Resources (usually with a dedicated folder for each).
If you have an even awesome setup or if you just want to share yours, feel free to send me a tweet.