Using 2 Editors Because Xcode Is Dumb
So I am working on auto-completion in NSTextView
in a package called TextKitAutoCompletion.
This is the first new Swift Package project I started with Xcode 16, I believe; the previous one was still Xcode 15. And with 16, they changed how you can reference local packages from example apps in subfolders.
Previously, you would be able to create an Xcode project in e.g. the Demo/
subfolder, then drag and drop the parent folder’s package into the project. The package would not be added to the “Package Dependencies” list, but rather added like other groups to the project – a feature that was introduced a while back to, I believe, allow temporary overrides to package dependencies that are usually read-only, so you can change the package code e.g. to fix a bug.
With Xcode 16, you have to add a local dependency instead, with ../../PACKAGE_NAME/
as the path.
And they don’t behave the same.
The new behavior is just broken.
- No file operations: When I add a new file to the local package, or remove a file, or rename a file, the Xcode demo app project can’t figure this out. I’m getting build errors and need to reopen the project. (Modifying existing files works, but if you introduce new types or functions, they also won’t be picked up properly
- No tests: Adding insult to injury, I cannot run a local Package’s tests, either. Xcode’s test plans don’t “see” the package tests at all. So I cannot start with an interactive demo and develop the Package from there.
- No two Xcode contexts: I also cannot open the Package separately, because it’s already open in the demo app Xcode window. (If the previous problem added insult to injury, I don’t know what proverb to use to express how frustrating it is what this problem piles on top.)
I can’t work that way.
I don’t know how you all get by.
The silver lining here is that I can use another editor to edit the Package and run tests, at least: the swift
build tools work fine from the command line, and SourceKit LSP is serviceable. You can use a modern editor to open the Swift Package, compile and test, and use Xcode to compile and run the app project.
For me, that means I can develop and test the Package itself in Emacs. (You also have my personal permission to use Neovim. But not VSCode!)
Overall, this is ridiculous.
I’d rather have kept Xcode 15. I tried to for as long as possible. (I still run Sonoma on my Mac!) – But this is what we get with 2020’s Apple software updates: mandatory major version bumps every year for all OS’s, SDK’s and Xcode, in various states of disrepair, and no way to not upgrade as developers. I’m fine with broken software, I’m not okay with all the pushing and prodding.
But I’m very happy that I have the option to use LSP and DAP at all to get some auto-completion and source editing feedback, proper syntax highlighting, and then compile or test with the same shortcuts, ⌘B or ⌘U respectively. It looks a bit weird at first, but it better than relaunching Xcode four times per hour.
If you have no hobby projects for 2025, yet, I suggest you learn a capable backup editor. Just in case.
- Emacs: https://emacsformacosx.com/
- Neovim: https://neovim.io/