This is completely broken in Xcode. Adding folders by folder reference (@Pavel's answer) should be correct - but it just doesn't work. See also https://stackoverflow.com/a/42600782/2518722. I'm using Xcode 8.3 (update: still broken in Xcode 11), but it's been broken for many generations prior, too.
There isn't a perfect workaround, but this is what I do:
- Drag the directory into the project
- When asked, set options as follows:
- Select Create groups for any added folder (ie, the opposite to what you think would be right)
- Deselect Copy files if needed (because you want a link, not a copy).
Now any changes to files in the shared directory will be reflected in Xcode, which is good.
But, there's no way of refreshing the group. (Someone please tell me if I'm missing something obvious here.) So if you've added new files to the directory, you have to remove the group in Xcode and re-add it before those files show up. This is obviously inconvenient, but at least it's not too prone to user error - and is better than adding files manually one-by-one.
Have to say I find it pretty unbelievable that such a simple and necessary feature of a development environment is so broken here.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…