I am trying to use folders instead of groups for a project. The goal is to avoid creating groups in the project files because those tend to cause merge conflicts in git.
Basically I want to have an Xcode project that respects the file structure on the project directory (like in Android projects) instead of using the reference system.
When I drag the folder into the project, I:
- disable "Copy items if needed"
- Added Folders: Create folder references
- Add to targets: MyTarget
This creates a folder hierarchy (in the project; blue folder icon) as I would expect. I can add/remove/rename files in Finder and see them update in Xcode.
Additionally the folder shows the correct target membership. (I've read that for folders, files get their target membership info from the top level folder. I.e. you don't need to set the target for each file.)
Unfortunately when I try to access one of the files, let's say EventBus.swift
, I get the error Use of unresolved identifier 'EventBus'
This seems like a target issue, but I'm not sure why targets would be a problem. Alternatively - perhaps since Xcode isn't managing a reference to the EventBus.swift
file...maybe the project doesn't know the file exists at all?
If the latter is true - I'm curious if there is any way to get around Xcode's conflict-prone reference system.