Question posted in Xcode
Whether you're new to Xcode or an experienced developer, our archive has everything you need to know about this integrated development environment (IDE). From basic functionalities to advanced features, our archive covers a wide range of Xcode-related questions and answers. Browse our archive now and find solutions to your Xcode questions, and take your app development skills to the next level
Whether you're new to Xcode or an experienced developer, our archive has everything you need to know about this integrated development environment (IDE). From basic functionalities to advanced features, our archive covers a wide range of Xcode-related questions and answers. Browse our archive now and find solutions to your Xcode questions, and take your app development skills to the next level
5
Answers
This is what I had to do using Xcode 14.0:
Package Dependencies
picked the+
to add a new package.Add Local...
and then picked the folder for my Swift Package (the folder that contains the package file)Frameworks, Libraries...
Then pick the+
and you should see your package listed as a framework. Select it and pickAdd
. Now Build.Step 2 is necessary to create a folder called "Packages" in your project. After Step 3, your package appears but is not expandable (to see the sources). Once you re-start Xcode and open this project (Step 5) the package should be fully visible.
I had to also do Step 7 to make this work. However, I have done this WITHOUT needing Step 7. It’s unclear why this happens.
Apple’s documentation says you can drag your package’s folder into the Project Navigator, but I have only been able to get that to work once. Every other time I’ve had to follow these steps, occasionally using Step 7.
Apple needs to finish this so using Swift Packages is simple. Its really a wonderful thing, but being able to use the package locally is critical to maintaining it easily
I was able to fix a similar issue I had by selecting the target in the Xcode project and scroll to
Frameworks, Libraries...
Then pick the + and you should see your package listed as a framework. Select them and pick Add.IMPORTANT: It may look like the libraries are already added but go ahead and add them again without deleted the existing entries. You won’t create duplicates, it just forces XCode to recreate the necessary indexes that were missing. I think this is a bug when adding packages from a Git URL.
i managed to get rid of these warnings by running the following from inside the directory where your project’s
.xcodeproj
file resides:xcodebuild -resolvePackageDependencies -project MyProject.xcodeproj -scheme MyScheme -platform="iOS, name:'Any iOS Device'"
Running this command might show some warnings in the terminal,
i received the following warning in my case…
Open your project after successfully executing this command,
and wait for the packages to get resolved and indexing to get done before trying to compile the project.
This solution was originally posted here by David to resolve another Swift Package Manager issue,
but this works well for resolving the issue asked in the OP as well.
Hope this helps.
Simply cleaning and building the project again fixed it for me
All I had to do is to go to
And just by magic, the warning disappeared!