Reputation: 16422
I started using groups in Xcode the same way I use packages in Java or namespaces in C++, even though groups have no effect on the language.
Then I discovered Smart Groups and realised that it's sort of pointless to have my code neatly organised in "folders".
Do you use groups? If so, how and why?
Upvotes: 7
Views: 5201
Reputation: 1
Groups are simple.
The only use I can find for them is bypassing the 10-object limit.
Ex:
VStack {
Group {
Text("Hello 1")
Text("Hello 2")
Text("Hello 3")
Text("Hello 4")
Text("Hello 5")
}
Group {
Text("Hello 6")
Text("Hello 7")
Text("Hello 8")
Text("Hello 9")
Text("Hello 10")
Text("Hello 11")
}
}
Upvotes: 0
Reputation: 96333
In the Info window for a group, you can set the group to correspond to a real folder on disk. Then, when you create files in your project by right-clicking on the group and choosing “Add New File”, Xcode will create the files in the group's folder.
I do this for my test case classes. You can do it for any set of classes you want to keep both in their own group and in their own folder.
Upvotes: 0
Reputation: 150625
If you're using unit tests, these can go in their own group as well.
Upvotes: 1
Reputation: 67839
As mentioned by others, I use groups for Model/View/Controller and for unit testing.
I use groups also for Doxygen documentation (doxyfile
configuration file and .dot
pictures) and for embedded applications such as ffmpeg
source code.
Upvotes: 0
Reputation: 46020
Groups are just an organisational tool, and you can use them in the way that is most logical to you.
Often developers will put their Model, View and Controller classes in separate groups. You might also want to put header files in their own group to reduce clutter.
I create a group for "utility" classes like categories, and a group for each main component of the application, for instance "Inspector" or "Preview". In those groups, the classes are further organised into Model, View and Controller groups.
It's up to you though, just do whatever feels natural.
Upvotes: 11