Skip to content

Convert to folder references where possible#1499

Merged
whattherestimefor merged 7 commits intomastodon:developfrom
aokj4ck:project/convert-to-folder-references-where-possible
Jan 6, 2026
Merged

Convert to folder references where possible#1499
whattherestimefor merged 7 commits intomastodon:developfrom
aokj4ck:project/convert-to-folder-references-where-possible

Conversation

@aokj4ck
Copy link
Copy Markdown
Contributor

@aokj4ck aokj4ck commented Jan 2, 2026

Description

  • Xcode 16 introduced Folder references which 1:1 match the filesystem with Swift sources
    • indicated with a blue folder icon instead of the previous gray folder icon
  • (All Swift Packages only use Folder references.)
  • Previously, Group references could match the filesystem but often would have:
    • unused sources that were missed from deletion during refactoring
    • symlinks or mis-organized source files
    • merge conflicts with pbxproj!
  • By using "Convert to Folder" on most groups we avoid all these problems.
  • This will dramatically reduce the risk of merge conflicts in Mastodon.pbxproj.

Discussion: https://mjtsai.com/blog/2024/10/07/xcode-16-folders-and-groups/
Documentation: https://developer.apple.com/documentation/xcode/managing-files-and-folders-in-your-xcode-project#Convert-groups-to-folders

Downsides

  • Sources are listed alphabetically and cannot be re-ordered
  • Not sure if this is compatible with Swiftgen or Sourcery!

Not Included

  • Sourcery templates
  • Resources with localizations that were not 1:1 with the filesystem

Documentation

There are several benefits to using folders instead of groups when organizing your Xcode project files. Folders have a much smaller representation in the project file, which can result in fewer merge conflicts because when you add or remove files to the project you don’t modify the project file. Additionally, your Xcode project file automatically updates as you make changes to the file system.

To convert a group into a folder using the Convert to Folder option within the Project navigator:

  1. Select one or more groups in your Project navigator.

  2. Control-click the selected group(s) and select Convert to Folder.

Xcode checks to see if the groups in your Xcode project match the underlying files and directories on disk. If they do, Xcode converts each group into a folder. If the groups and underlying directory structures don’t match, Xcode displays a dialog with a Show Details button. Click the Show Details button to see a list of the files and directories Xcode couldn’t convert.

To convert the files Xcode displays in Show Details, make the file and directory structure in Xcode match what Finder displays on disk. Either modify the file and group structure in Xcode to match the file and directory structure in Finder, or modify the file and directory structure in Finder to match the contents of your groups in Xcode. Then select the groups, Control-click, and choose Convert to Folder again.

— https://developer.apple.com/documentation/xcode/managing-files-and-folders-in-your-xcode-project#Convert-groups-to-folders

@aokj4ck aokj4ck marked this pull request as ready for review January 2, 2026 20:39
@aokj4ck
Copy link
Copy Markdown
Contributor Author

aokj4ck commented Jan 3, 2026

PR-1499 will achieve some of the changes from #1238 and prevent the conditions that left unused source files

@whattherestimefor whattherestimefor merged commit d31cc38 into mastodon:develop Jan 6, 2026
2 checks passed
@aokj4ck aokj4ck deleted the project/convert-to-folder-references-where-possible branch January 31, 2026 04:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants