Good structure can help you increase your efficiency.
What are the most common ways to oganize the project structure?
There is not correct answer here, depend on developers.
Today, I will show you 2 common ways to arrange files in project which can help you access to files easier.
Any projects have at least 2 features. Large projects have many features. This way has 2 advantages:
- You can access to other related files in the same folder. Press
Ctrl + 5to quick access files in the same folder.
- You can copy folders to new projects and reuse it easily. This is the reason I love this way.
Where should I put the models, which are used in many features?
Commonfolder is an option.
But I usually put it in the most related folder. For example:
Productmodel is in folder
Usermodel is in folder
You can make many folders of same purpose files like,
You have right folders for right types, don't have to confuse where to put files.
This way is very easy for newcomers (junior developers), they can easily find the files they want.
I don't use this way so I don't know more benefits of it. Anyone who is using it, please share me in comments.
Naming is very important. Descriptive names help you easy to find and understand the mission of files.
Some things you should know in naming.
RegisterController should be written in
RegisterController.swift. You don't have to remember 2 names, just one for Register feature. Keep your mind free to remember other things.
The folder name can be
RegisterController, no problem. You can understand its functionality at first glance, right.
If you're using
group by types way, you can name your files with prefix is feature name as above example. Benefits are below.
Hope these tips can help you increase your coding performance. Please share me how you organize your project structure. I am sure your ways are awesome ways.
Introduce a very cool tool: https://github.com/venmo/synx. You should try it.