Generate XCFrameworks from Swift Package Manager dependency.
XPM utilizes Swift Package Manager to resolve the dependency graph and checking repositories out. Packages/frameworks maintainers have to do nothing other than putting Package.swift in the repository.
When you have a package:
let package = Package(
name: "Some",
dependencies: [
.package(url: "https://github.com/Foo/Foo.git", from: "..."),
.package(url: "https://github.com/Bar/Bar.git", from: "..."),
],
targets: [
.target(
name: "SomeKit",
dependencies: ["Foo"]
),
.target(
name: "SomeCore",
dependencies: ["Bar"]
),
]
)
Run xpm build
to export SomeKit.xcframework
and SomeCore.xcframework
,
along with Foo.xcframework
and Bar.xcframework
.
$ swift run xpm build --platforms ios,iphonesimulator,macos --output Frameworks
Run xpm build
with --dependency-of <targetName>
option to export
just Foo.xcframework
.
$ swift run xpm build --dependency-of SomeKit --platforms ios,iphonesimulator,macos --output Frameworks