{"id":19093851,"url":"https://github.com/mussacharles/xcframeworkscripts","last_synced_at":"2026-03-19T08:05:14.326Z","repository":{"id":139084360,"uuid":"538902835","full_name":"MussaCharles/XCFrameworkScripts","owner":"MussaCharles","description":"Useful Scripts used to build XCFramework and links to learning materials. ","archived":false,"fork":false,"pushed_at":"2022-10-21T11:15:58.000Z","size":86,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-02-22T07:55:14.865Z","etag":null,"topics":["spm","xcframework","xcframeworks","xcode"],"latest_commit_sha":null,"homepage":"","language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/MussaCharles.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"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":"2022-09-20T09:16:24.000Z","updated_at":"2022-09-25T11:23:08.000Z","dependencies_parsed_at":null,"dependency_job_id":"c3a04ee5-4ef4-42e1-8923-824651d024e6","html_url":"https://github.com/MussaCharles/XCFrameworkScripts","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/MussaCharles/XCFrameworkScripts","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MussaCharles%2FXCFrameworkScripts","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MussaCharles%2FXCFrameworkScripts/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MussaCharles%2FXCFrameworkScripts/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MussaCharles%2FXCFrameworkScripts/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/MussaCharles","download_url":"https://codeload.github.com/MussaCharles/XCFrameworkScripts/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MussaCharles%2FXCFrameworkScripts/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29876358,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-26T22:37:10.609Z","status":"ssl_error","status_checked_at":"2026-02-26T22:37:09.019Z","response_time":89,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["spm","xcframework","xcframeworks","xcode"],"created_at":"2024-11-09T03:26:20.651Z","updated_at":"2026-02-26T23:03:33.181Z","avatar_url":"https://github.com/MussaCharles.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"# XCFrameworkScripts\nUseful Scripts used to build XCFramework and links to learning materials. \n\n## Introduction\nThe following scripts can be copy pasted to terminal (Make sure you are inside a project folder) and produce .framework then the final script is used to combine the individual generated archives into single .XCFramework ready for distribution. \n\nNote: Before creating an xcframework builds needs to be archived for all supported architectures as shown on the steps below.  \n\n## Archive for iOS iPhone (Release)\n\n```shell\nxcodebuild archive \\\n-scheme \u003cYOUR FRAMEWORK NAME\u003e \\\n-configuration Release \\\n-destination 'generic/platform=iOS' \\\n-archivePath './build/\u003cYOUR FRAMEWORK NAME\u003e.framework-iphoneos.xcarchive' \\\nSKIP_INSTALL=NO \\\nBUILD_LIBRARIES_FOR_DISTRIBUTION=YES\n\n```\nThe above command will generate an archive of your framework by using the following list as inputs :\n\n1. **-scheme \u003cYOUR FRAMEWORK NAME\u003e**: It’ll use this scheme for archiving (Make sure you specify a project name/scheme as it appear on the Xcode project).\n2. **-configuration Release**: It’ll use the release configuration for building.\n3. **-destination ‘generic/platform=iOS’**: This is the architecture type.\n4. **-archivePath**: It saves archives into this folder path with the given name.\n5. **SKIP_INSTALL**: Set NO to install the framework to the archive.\n6. **BUILD_LIBRARIES_FOR_DISTRIBUTION**: Ensures your libraries are built for distribution and creates the interface file.\n\n\n\n## Archive for iOS Simulator (Release)\n```shell\nxcodebuild archive \\\n-scheme \u003cYOUR FRAMEWORK NAME\u003e \\\n-configuration Release \\\n-destination 'generic/platform=iOS Simulator' \\\n-archivePath './build/\u003cYOUR FRAMEWORK NAME\u003e.framework-iphonesimulator.xcarchive' \\\nSKIP_INSTALL=NO \\\nBUILD_LIBRARIES_FOR_DISTRIBUTION=YES\n```\n  \n  These command options are the same as those for iOS except for the following differences:\n\n1. **-destination ‘generic/platform=iOS Simulator’**: This is where you set the architecture type.\n2. **-archivePath**: This generates the archive into the folder path with the given name.\n   \n## Archive for macOS (Release)\n  ```shell\n  xcodebuild archive \\\n-scheme \u003cYOUR FRAMEWORK NAME\u003e \\\n-configuration Release \\\n-destination 'platform=macOS,arch=x86_64,variant=Mac Catalyst' \\\n-archivePath './build/\u003cYOUR FRAMEWORK NAME\u003e.framework-catalyst.xcarchive' \\\nSKIP_INSTALL=NO \\\nBUILD_LIBRARIES_FOR_DISTRIBUTION=YES\n  ```\n  \n  This command is the same as the others except for the following differences:\n\n1. **-destination ‘platform=macOS,arch=x86_64,variant=Mac Catalyst’**: This is where you indicate the architecture type.\n2. **-archivePath**: This generates the archive into the folder path with the given name.\n\n\n  ## Generate XCFramework\n  This command adds your XCFramework to the build folder using the generated archives above.\n  ```shell\n  xcodebuild -create-xcframework \\\n-framework './build/\u003cYOUR FRAMEWORK NAME\u003e.framework-iphonesimulator.xcarchive/Products/Library/Frameworks/\u003cYOUR FRAMEWORK NAME\u003e.framework' \\\n-framework './build/\u003cYOUR FRAMEWORK NAME\u003e.framework-iphoneos.xcarchive/Products/Library/Frameworks/\u003cYOUR FRAMEWORK NAME\u003e.framework' \\\n-framework './build/\u003cYOUR FRAMEWORK NAME\u003e.framework-catalyst.xcarchive/Products/Library/Frameworks/\u003cYOUR FRAMEWORK NAME\u003e.framework' \\\n-output './build/\u003cYOUR FRAMEWORK NAME\u003e.xcframework'\n  ```\n \n#  Learning Materials\nAs I was working working with XCFrameworks, I found the following online learning materials to be very helpful. These can act as a shortcut to quickly read or watch about frameworks or packages without spending much time to search on the web. \n\n\n## Binary Frameworks\n1. [Apple Docs: Distributing Binary Frameworks as Swift Packages](https://developer.apple.com/documentation/xcode/distributing-binary-frameworks-as-swift-packages)\n\n2. [Medium: Binary Frameworks in Swift — XCFrameworks](https://medium.com/macoclock/binary-frameworks-in-swift-xcframeworks-5bd35f50e13a) \n\n3. [WWDC 2019: Binary frameworks in Swift](https://developer.apple.com/wwdc19/416)\n  \n4. [WWDC 2020: Distribute Binary frameworks as Swift packages](https://developer.apple.com/wwdc20/10147)\n\n5. [iOS Deep Understanding of Libraries and Frameworks](https://www.youtube.com/watch?v=lGG0UPdvc54\u0026t=1225s\u0026ab_channel=WizelineAcademy)\n\n## Adding SPM to existing frameworks/libraries\n1. Article -\u003e  [Creating a Swift Package from an existing iOS Framework (Library)](https://emmanuelkehinde.io/creating-a-swift-package-from-an-existing-ios-framework-library/)\n\n2. Medium -\u003e [Creating XCFramework from Swift Package](https://mustafa-ysf.medium.com/creating-xcframework-from-swift-package-e8af6f44501f)\n\n3. Article -\u003e [How to create a Swift Package from a CocoaPods project](https://dragosneagu.com/how-to-create-a-swift-package-from-an-existing-cocoapods-project/)\n\n\n## Swift Package Manager\n\n- [Package Manager Official Documentation](https://www.swift.org/package-manager/) \n\n- [SPM Package manifest file docs](https://docs.swift.org/package-manager/PackageDescription/PackageDescription.html)\n\n- [WWDC 2018: Getting to Know Swift Package Manager](https://developer.apple.com/videos/play/wwdc2018/411/)\n\n- [WWDC 2019, Creating Swift packages](https://developer.apple.com/wwdc19/410)\n\n- [WWDC 2019: Adopt Swift Packages in Xcode](https://developer.apple.com/wwdc19/408)\n\n- [WWDC 2021: Swift packages collections (grouping)](https://developer.apple.com/wwdc21/10197)\n\n- [WWDC 2022: Swift package plugins](https://developer.apple.com/wwdc22/110359)\n\n- [Swift by Sundell:Managing dependencies using the Swift Package Manager](https://www.swiftbysundell.com/articles/managing-dependencies-using-the-swift-package-manager/)\n  \n- [Apple Docs: Creating a Standalone Swift Package with Xcode](https://developer.apple.com/documentation/xcode/creating-a-standalone-swift-package-with-xcode)\n\n- [Apple Docs: Bundling Resources with a Swift Package](https://developer.apple.com/documentation/xcode/bundling-resources-with-a-swift-package)\n\n- [Stackoverflow: Add demo app to SPM](https://stackoverflow.com/a/69659509/7551807)\n  - As a side note, project should be closed before following the steps on the linked answer. \n  \n- [Medium article: SPM with mixed Swift and ObjC files](https://joesusnick.medium.com/swift-package-manager-with-a-mixed-swift-and-objective-c-project-part-1-2-19fbb43d0460)\n\n- [Apple Docs: Organizing Your Code with Local Packages](https://developer.apple.com/documentation/xcode/organizing-your-code-with-local-packages)\n\n- [Apple Docs: Developing a Swift Package in Tandem with an App](https://developer.apple.com/documentation/xcode/developing-a-swift-package-in-tandem-with-an-app)\n\n- [Apple Docs: Editing a Package Dependency as a Local Package](https://developer.apple.com/documentation/xcode/editing-a-package-dependency-as-a-local-package)\n\n- [Swift Heroes: Advanced Swift Package Manager](https://www.youtube.com/watch?v=g9bBph435Lc\u0026ab_channel=SwiftHeroes)\n\n\n## Credits\n1. [Raywenderlich -\u003e Creating a Framework for iOS](https://www.raywenderlich.com/17753301-creating-a-framework-for-ios#toc-anchor-002)\n2. [Official Apple Docs -\u003e Create an XCFramework](https://help.apple.com/xcode/mac/11.4/#/dev544efab96)\n3. [Raywenderlich -\u003e Swift Package Manager for iOS](https://www.raywenderlich.com/7242045-swift-package-manager-for-ios)\n\n## Related open source projects\nThe following is the list of open source projects which automate the process or creating frameworks. \n- [swift-create-xcframework](https://github.com/unsignedapps/swift-create-xcframework) \n- [surmagic](https://github.com/gurhub/surmagic) \n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmussacharles%2Fxcframeworkscripts","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmussacharles%2Fxcframeworkscripts","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmussacharles%2Fxcframeworkscripts/lists"}