Need help with swift-create-xcframework?
Click the “chat” button below for chat support from the developer who created it, or find similar developers for support.

About the developer

235 Stars 12 Forks MIT License 60 Commits 6 Opened issues


A simple Command Line Tool to create XCFrameworks by wrapping xcodebuild.

Services available


Need anything else?

Contributors list

No Data


swift-create-xcframework is a very simple tool designed to wrap

and the process of creating multiple frameworks for a Swift Package and merging them into a single XCFramework.

On the 23rd of June 2020, Apple announced Xcode 12 and Swift 5.3 with support for Binary Targets. Though they provide a simplified way to include Binary Frameworks in your packages, they did not provide a simple way to create your XCFrameworks, with only some documentation for the long manual process. swift-create-xcframework bridges that gap.

Note: swift-create-xcframework pre-dates the WWDC20 announcement and is tested with Xcode 11.4 or later, but should work with Xcode 11.2 or later. You can include the generated XCFrameworks in your app manually even without Xcode 12.


Inside your Swift Package folder you can just run:

swift create-xcframework

By default swift-create-xcframework will build XCFrameworks for all library products in your Package.swift, or any targets you specify on the command line (this can be for any dependencies you include as well).

Then for every target or product specified, swift-create-xcframework will:

  1. Generate an Xcode Project for your package (in
  2. Build a
    for each supported platform/SDK.
  3. Merge the SDK-specific framework into an XCFramework using
    xcodebuild -create-xcframework
  4. Optionally package it up into a zip file ready for a GitHub release.

This process mirrors the official documentation.

Choosing what to build

Let's use an example

var package = Package(
    name: "example-generator",
    platforms: [
    products: [
            name: "ExampleGenerator",
            targets: [ "ExampleGenerator" ]),
    dependencies: [],
    targets: [

By default swift-create-xcframework will build

that supports: macosx, iphoneos, iphonesimulator. Additional
products would be built automatically as well.

Choosing Platforms

You can narrow down what gets built If you omit the platforms specification, we'll build for all platforms that support Swift Binary Frameworks, which at the time of writing is just the Apple SDKs: macosx, iphoneos, iphonesimulator, watchos, watchsimulator, appletvos, appletvsimulator.

Note: Because only Apple's platforms are supported at this time, swift-create-xcframework will ignore Linux and other platforms in the Package.swift.

You can specify a subset of the platforms to build using the

option, for example:
swift create-xcframework --platform ios --platform macos ...


You can build your XCFrameworks with support for Mac Catalyst by specifying

--platform maccatalyst
on the command line. As you can't include or exclude Catalyst support in your
we don't try to build it automatically.

Choosing Products

Because we wrap

, you can actually build XCFrameworks from anything that will be mapped to an Xcode project as a Framework target. This includes all of the dependencies your Package has.

To see whats available:

swift create-xcframework --list-products

And then to choose what to build:

swift create-xcframework Target1 Target2 Target3...

By default it builds all top-level library products in your Package.swift.

Command Line Options

Because of the low-friction to adding command line options with swift-argument-parser, there are a number of useful command line options available, so

should be your first port of call.

Packaging for distribution

swift-create-xcframework provides a

option to automatically zip up your newly created XCFrameworks ready for upload to GitHub as a release artefact, or anywhere you choose.

If the target you are creating an XCFramework happens to be a dependency, swift-create-xcframework will look back into the package graph, locate the version that dependency resolved to, and append the version number to your zip file name. eg:

If the target you are creating is a product from the root package, unfortunately there is no standard way to identify the version number. For those cases you can specify one with


Because you're probably wanting to distribute your binary frameworks as Swift Packages

swift create-xcframework --zip
will also calculate the necessary SHA256 checksum and place it alongside the zip. eg:

GitHub Action

swift-create-xcframework includes a GitHub Action that can kick off and automatically create an XCFramework when you tag a release in your project.

The action produces one zipped XCFramework and checksum artifact for every target specified.

Note: You MUST use a macOS-based runner (such as

) as xcodebuild doesn't run on Linux.

You can then take those artifacts and add them to your release.

An incomplete example:


name: Create Release

Create XCFramework when a version is tagged

on: push: tags:

jobs: create_release: name: Create Release runs-on: macos-latest steps:

  - uses: actions/[email protected]

  - name: Create XCFramework
    uses: unsignedapps/[email protected]

  # Create a release
  # Upload those artifacts to the release


You can install using mint:

mint install unsignedapps/[email protected]

Or manually:

git clone
cd swift-create-xcframework
make install

Either should pop the swift-create-xcframework binary into

. And because the
binary is extensible, you can then call it as a subcommand of
swift create-xcframework --help


Please read the Contribution Guide for details on how to contribute to this project.


swift-create-xcframework is available under the MIT license. See the LICENSE file for more info.

We use cookies. If you continue to browse the site, you agree to the use of cookies. For more information on our use of cookies please see our Privacy Policy.