{"id":21762091,"url":"https://github.com/segment-integrations/swift-create-xcframework","last_synced_at":"2025-04-04T20:16:51.113Z","repository":{"id":192867336,"uuid":"679480808","full_name":"segment-integrations/swift-create-xcframework","owner":"segment-integrations","description":"A simple Command Line Tool to create XCFrameworks by wrapping xcodebuild.","archived":false,"fork":false,"pushed_at":"2025-03-27T22:05:32.000Z","size":289,"stargazers_count":147,"open_issues_count":1,"forks_count":19,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-03-27T23:19:40.260Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Swift","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"unsignedapps/swift-create-xcframework","license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/segment-integrations.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-08-17T00:19:09.000Z","updated_at":"2025-03-27T22:05:36.000Z","dependencies_parsed_at":null,"dependency_job_id":"875c9469-161b-4f8e-8dfd-49402e09c3e2","html_url":"https://github.com/segment-integrations/swift-create-xcframework","commit_stats":null,"previous_names":["bsneed/swift-create-xcframework","segmentio/swift-create-xcframework","segment-integrations/swift-create-xcframework"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/segment-integrations%2Fswift-create-xcframework","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/segment-integrations%2Fswift-create-xcframework/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/segment-integrations%2Fswift-create-xcframework/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/segment-integrations%2Fswift-create-xcframework/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/segment-integrations","download_url":"https://codeload.github.com/segment-integrations/swift-create-xcframework/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247242683,"owners_count":20907134,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-26T12:10:53.797Z","updated_at":"2025-04-04T20:16:51.106Z","avatar_url":"https://github.com/segment-integrations.png","language":"Swift","funding_links":[],"categories":["Swift"],"sub_categories":[],"readme":"# NOTE:\n\nThis tool is a maintained fork of the original unsignedapps/swift-create-xcframework.  This unlinked fork started off to add Xcode 15 support, after waiting for 8+ months for the original author to merge the PR.  Things like the github action, and mint installation haven't been tested.  It's currently been set up to install via `brew` or manually.  More to come, please file bugs/PRs here.\n\n# swift-create-xcframework\n\nswift-create-xcframework is a very simple tool designed to wrap `xcodebuild` and the process of creating multiple frameworks for a Swift Package and merging them into a single XCFramework.\n\nOn 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][apple-docs], they did not provide a simple way to create your XCFrameworks, with only some [documentation for the long manual process][manual-docs]. swift-create-xcframework bridges that gap.\n\n**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.\n\n## Usage\n\nInside your Swift Package folder you can just run:\n\n```shell\nswift create-xcframework\n```\n\nBy 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).\n\nThen for every target or product specified, swift-create-xcframework will:\n\n1. Generate an Xcode Project for your package (in `.build/swift-create-xcframework`).\n2. Build a `.framework` for each supported platform/SDK.\n3. Merge the SDK-specific framework into an XCFramework using `xcodebuild -create-xcframework`.\n4. Optionally package it up into a zip file ready for a GitHub release.\n\nThis process mirrors the [official documentation][manual-docs].\n\n## Choosing what to build\n\nLet's use an example `Package.swift`:\n\n```swift\nvar package = Package(\n    name: \"example-generator\",\n    platforms: [\n\t    .ios(.v12),\n    \t .macos(.v10_12)\n    ],\n    products: [\n        .library(\n            name: \"ExampleGenerator\",\n            targets: [ \"ExampleGenerator\" ]),\n    ],\n    dependencies: [],\n    targets: [\n\t\t...\n\t]\n)\n```\n\nBy default swift-create-xcframework will build `ExampleGenerator.xcframework` that supports: macosx, iphoneos, iphonesimulator. Additional `.library` products would be built automatically as well.\n\n### Choosing Platforms\n\nYou can narrow down what gets built\nIf 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.\n\n**Note:** Because only Apple's platforms are supported at this time, swift-create-xcframework will ignore Linux and other platforms in the Package.swift.\n\nYou can specify a subset of the platforms to build using the `--platform` option, for example:\n\n```shell\nswift create-xcframework --platform ios --platform macos ...\n```\n\n#### Catalyst\n\nYou 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 `Package.swift` we don't try to build it automatically.\n\n### Choosing Products\n\nBecause we wrap `xcodebuild`, 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.\n\nTo see whats available:\n\n```shell\nswift create-xcframework --list-products\n```\n\nAnd then to choose what to build:\n\n```shell\nswift create-xcframework Target1 Target2 Target3...\n```\n\nBy default it builds all top-level library products in your Package.swift.\n\n## Command Line Options\n\nBecause of the low-friction to adding command line options with [swift-argument-parser](https://github.com/apple/swift-argument-parser), there are a number of useful command line options available, so `--help` should be your first port of call.\n\n## Packaging for distribution\n\nswift-create-xcframework provides a `--zip` option to automatically zip up your newly created XCFrameworks ready for upload to GitHub as a release artifact, or anywhere you choose.\n\nIf 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: `ArgumentParser-0.0.6.zip`\n\nIf 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 `--zip-version`.\n\nBecause you're probably wanting to [distribute your binary frameworks as Swift Packages][apple-docs] `swift create-xcframework --zip` will also calculate the necessary SHA256 checksum and place it alongside the zip. eg: `ArgumentParser-0.0.6.sha256`.\n\n## GitHub Action\n\nswift-create-xcframework includes a GitHub Action that can kick off and automatically create an XCFramework when you tag a release in your project.\n\nThe action produces one zipped XCFramework and checksum artifact for every target specified.\n\n**Note:** You MUST use a macOS-based runner (such as `macos-latest`) as xcodebuild doesn't run on Linux.\n\nYou can then take those artifacts and add them to your release.\n\nAn incomplete example:\n\n### .github/workflows/create-release.yml\n\n```yaml\nname: Create Release\n\n# Create XCFramework when a version is tagged\non:\n  push:\n    tags:\n\njobs:\n  create_release:\n    name: Create Release\n    runs-on: macos-latest\n    steps:\n\n      - uses: actions/checkout@v2\n\n      - name: Create XCFramework\n        uses: unsignedapps/swift-create-xcframework@v2\n\n      # Create a release\n      # Upload those artifacts to the release\n```\n\n## Installation\n\nYou can install using brew:\n\n```shell\nbrew install segment-integrations/formulae/swift-create-xcframework\n```\n\nOr manually:\n\n```shell\ngit clone https://github.com/unsignedapps/swift-create-xcframework.git\ncd swift-create-xcframework\nmake install\n```\n\nEither should pop the swift-create-xcframework binary into `/usr/local/bin`. And because the `swift` binary is extensible, you can then call it as a subcommand of `swift` itself:\n\n```shell\nswift create-xcframework --help\n```\n\n## Contributing\n\nPlease read the [Contribution Guide](CONTRIBUTING.md) for details on how to contribute to this project.\n\n## License\n\nswift-create-xcframework is available under the MIT license. See the [LICENSE](LICENSE) file for more info.\n\n[apple-docs]: https://developer.apple.com/documentation/swift_packages/distributing_binary_frameworks_as_swift_packages\n[manual-docs]: https://help.apple.com/xcode/mac/11.4/#/dev544efab96\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsegment-integrations%2Fswift-create-xcframework","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsegment-integrations%2Fswift-create-xcframework","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsegment-integrations%2Fswift-create-xcframework/lists"}