I already posted this topic in the Apple Developer forum. But as expected it's a desert of answers over there. So I try it again here in the Swift forums.
Xcode 16 seems to „forget“ a swift package within a subfolder of a root package after restart or shut-down.
I have a Swift package with some tools sub-packages, which are only used during development of the main package and are not intended to be used by the consumer of the main package nor are these tools a dependency of the main package.
This is the project structure, which also resembles the directory structure on disc:
MyPackage
- Package.swift
- README.md
- Sources
- MyPackage
- Tests
- MyPackageTests
- Tools
- MyGenerator // <- after restart this folder is not visible in the Xcode project navigator
- Package.swift
- Sources
- main.swift
- Tests
MyGenerator is a standalone tools package which is used during development of MyPackage to generate source code files for MyPackage based on text file input. Essentially an executable target script which I can run within its folder with swift run MyGenerator someInputFile.txt
.
MyPackage does NOT use MyGenerator as a dependency, nor do I want this tool listed as a dependency in MyPackage Package.swift
file. Yet MyGenerator is part of the same Git repo, as it documents the changes to the tool on how to generate source code for MyPackage. Both packages are developed in tandem.
MyGenerator itself defines dependencies in its Package.swift
file, which are unrelated to the functionality of MyPackage.
After restart of Xcode or even just after a longer shut-down period the MyGenerator subfolder is not visible in the Xcode project navigator, the /Tools
folder is empty. I have to manually add the sub package via Add files to "MyPackage"
-> Move files to destination
every time.
How can I solve that Xcode remembers the sub package unter /Tools
?
I tried creating a Workspace under the MyPackage folder (so it is nicely contained within the projects folder). I can then add the MyGenerator package to the workspace, but not the main MyPackage folder.
I appreciate any tips of even hints to best practices in how to handle the folder structure.