A while ago, perhaps early in v16, Xcode stopped tracking file liveness. I'd hoped the regression would be fixed, but... not yet.
Is there some setting I'm missing? Is this from underlying filesystem limits? or from working with swift packages?
Conversely, if/since this is a regression, is this the new normal, and not to be fixed (e.g., because the modern build system cannot be retrofitted to detect and update stale resources)?
Assuming I create a Swift package and open it in Xcode...
1. New files
I expect to get errors when I create a new swift file, add bad code, and build.
Instead, the file doesn't seem to be added to the build.
If I try to use Add Files to "{project}"..
menu, the file is disabled for selection.
A workaround is to close and re-open the project
2. Files updated extrinsically
If outside Xcode I format the files in the package or edit them, I expect Xcode to notice and either 1) update with the new contents if there were no changes, or 2) ask what to do if there were changes.
Instead, Xcode proceeds oblivious to the underlying changes.
It is not a workaround to use Integrate/Refresh file status
menu for SCM status.
Again, a workaround is to close and re-open the project.
Possible factors
- Swift package projects, if resource tracking is tied to metadata unused in package projects?
- External filesystem: these are on APFS volumes mounted via TB-4 and USB-3
- Pilot error?
Impact
This leads me to re-open projects 10's of times a day, to create test files or maintain lint. Also, because I have to drop out of Xcode to process files before checking in, I end up using an external git workflow/UI.
Also, because Xcode is not particularly extensible, I've written external tools for analyzing and generating Swift, hosted via CLI or eclipse (which support resource markers for UI navigation). I use Swift LSP in Eclipse for analysis and git-driven changes, and end up coding there because well, I'm already there.
I'd take slower builds over this continuous hassle and context-switching in a heartbeat.