Reputation: 10591
I want to be able to take an internal SPM package, which depends on several other internal (and one external) SPM packages, and compile it into an XCFramework, using a series of xcodebuild
like you would for a framework project. For example, I have PackageB
, which references PackageA
, and I'm trying to build PackageB.xcframework
. The first step would be:
xcodebuild -scheme PackageB -destination "generic/platform=iOS" -configuration Release ARCHS="arm64" BUILD_DIR="./Build
The tool's output indicates that the dependency packages are being resolved, but they are then not recognized by the compiler (i.e. code in PackageB
which references PackageA
will not compile because PackageA
is unknown at that point).
Thanks for any pointers.
Upvotes: 8
Views: 6245
Reputation: 2762
You can create xcframework from swift package by using swift-create-xcframework command line tool, there is also GitHub action available for this.
If you don't want to use this tool, you can generate Xcode project by using swift package generate-xcodeproj
command:
OVERVIEW: Generates an Xcode project. This command will be deprecated soon.
USAGE: swift package generate-xcodeproj
OPTIONS: --xcconfig-overrides Path to xcconfig file --output Path where the Xcode project should be generated --legacy-scheme-generator Use the legacy scheme generator --watch Watch for changes to the Package manifest to regenerate the Xcode project --skip-extra-files Do not add file references for extra files to the generated Xcode project --version Show the version. -h, -help, --help Show help information.
and then create xcframework with the generated Xcode project.
Upvotes: 4