Xcode 16 Folders and Groups
In Xcode 16, project files and folders are arranged differently in the Project navigator. What used to be a group is now a folder, and this simple change has some interesting effects. At first, I was against the new scheme - in fact in my SwiftUI for Mac 2024 article, I specifically recommended reverting back to the old group method. But after doing some more reading and testing, I think the answer is not so clear cut.
[…]
At a first glance, there are two differences: the order of the files & folders and the color of the folder icons. A less obvious difference is that in Xcode 15, I can drag files around to arrange them in the order I prefer. In Xcode 16, I can’t do that. I can drag files into or out of folders, but I can’t move them around at the same level.
[…]
This points out the fundamental difference between the two approaches: groups are an artificial construct that is stored in the project files. Usually, this mirrors the file and folder structure in Finder, but it doesn’t have to. When you use folders, Xcode is reading the file and folder structure directly from the Finder.
[…]
The big difference is in source control, especially if you’re working with other people. When every file addition, deletion or move also changes the project file, you have a much greater chance of getting a merge conflict.
Previously:
Update (2024-10-24): Thomas Ricouard:
I’ve recently migrated Ice Cubes, my open-source SwiftUI Mastodon client to use file system folders instead of Xcode groups.
[…]
Folders have many advantages over Xcode virtual groups, so I think it’s worth enumerating them in an article so you can get the gist of it.
2 Comments RSS · Twitter · Mastodon
This could be just solved similar to the editorconfig ... simply by using a merge friendly file format to store the ordering. There is no reason that file reordering should produce a merge conflict, after all we reorder lines in code just fine all the time.
+1 Not being able to reorder files in the project navigator (because they are in a “folder”) is not the solution to resolving conflicts.
They can just persist the order in its own file inside .xcodeproj package which you can gitignore like you do with breakpoints, etc.
Apple seems to be making quite a few questionable decisions lately.