XCode 16 beta 3 creating a folder instead of a group for all project initial content

When I new project is initiated in XCode 16 beta 3, an overall folder is created to contain all the generated content in the Navigator pane . In past XCode version, this main container (under the project name) has always been generated as a group. Is this change by design or a bug? The issue this creates is that the files and folders in this overall Folder can not be repositioned - they remain in ascending alphabetical order. I must convert this initial Folder into a Group by right clicking on the folder name and selecting "Convert to group" which converts the folder to a group. I am then able to reposition files, groups and folders within this group. I don't see anywhere in the XCode documentation where this change in behavior is mentioned.

Anyone else having this same issue. I never have understood the difference or use cases for groups vs folders in the xcode Navigator pane.

Answered by Developer Tools Engineer in 795641022

We chose to use folders rather than groups for new projects because they can substantially reduce the changes needed to a project when adding and changing source files, since by using folders every source file doesn’t need a direct reference from the project file, and this is how most other environments work these days.

You can always convert the folder to a group if you’d prefer to manage the references to files in your project yourself.

I don't see anywhere in the XCode documentation where this change in behavior is mentioned.

From Xcode Updates > Projects and workspaces :

  • Minimize project file changes and avoid conflicts with buildable folder references. Convert an existing group to a buildable folder with the Convert to Folder context menu item in the Project Navigator. Buildable folders only record the folder path into the project file without enumerating the contained files, minimizing diffs to the project when your team adds or removes files, and avoiding source control conflicts. To use a folder as an opaque copiable resource, the default behavior before Xcode 16, uncheck the Build Folder Contents option in the File Inspector.

  • Create groups with associated folders by default when using the New Group and New Group from Selection commands in the Project Navigator. To create a group without a folder, hold the Option key in the context menu to reveal the New Group without Folder variant of the command.

I never have understood the difference or use cases for groups vs folders in the xcode Navigator pane.

For more information, see Add existing files and folders to a project, Organize project files in the navigator , and Convert groups to folders.

See my comment to last response.

I did read the above docunetaditon. However, there is no explanation as to why a Folder is now being created instead of a Group at initial project build. A folder would be fine if I could manage the position of the files within in. It appears that all I get is alphabetical order. So what I need is the initial project build to create a group linked to a "real" folder at initial project build. Otherwise, I must covert the folder to a group to get the same file management behavior as in xcode 15.

We chose to use folders rather than groups for new projects because they can substantially reduce the changes needed to a project when adding and changing source files, since by using folders every source file doesn’t need a direct reference from the project file, and this is how most other environments work these days.

You can always convert the folder to a group if you’d prefer to manage the references to files in your project yourself.

Accepted Answer

Great. Thanks for the clarification.

I use Xcode (and its predecessors since '90) I ALWAYS liked the old behaviour: you can selectively add folders, files, and even folder in other paths and rearrange. I have been considering that "old" behaviour FAR better that bogus management approach of Visual studio, and FAR FAR better that IntelliJ / Maven logic (all crap in every sub-folder is good!!)

I did appreciate you can move file dropping around the project: helpful to keep related file together. (think about views and controller in a MVC project, for example)

A project IS NOT the contents of a folder, that is Finder logic!

the new PACKAGE/SPM approach is rough, but acceptable, but honestly old behaviour has many good reasons to be.

If Apple did change it to allow young developers coming from Java / maven or worst VS Code to use Apple ecosystem.. id a bad choice, IMHO.

otherwise.. I wuold use jet brains IDEs to exploit that behaviour. :)

I did try to make a group. You say ".. Create groups with associated folders by default when using the New Group and New Group from Selection commands in the Project Navigator. To create a group without a folder, hold the Option key in the context menu to reveal the New Group without Folder variant of the command."

(I am using Version 16.0 beta 3 (16A5202i)

but I see only:

If Use use instead option while selecting, it will open in this way:

When a collection of source files is contained in an Xcode group, re-ordering of the files is possible. When they are contained in an Xcode folder, re-ordering of files is impossible.

The technical explanation of why a folder is favoured over a group is somewhat at odds with the user experience for all developers. (I've also worked with high school developers who complain that they can't change the order of files in Swift Playgrounds).

Co-existing with source control and collaboration could be viewed as a "model" issue. Being able to change the sort order of files is a "view" issue. Surely through the Xcode user file the ordering could be kept separate (and local) from what is shared collaboratively.

Being able to change the order a files in a project is a super common use case.

The project repository would not want the file ordering changes from multiple users being part of the check in - hence why this could be store in the user defaults for the project in Xcode.

XCode 16 beta 3 creating a folder instead of a group for all project initial content
 
 
Q