macOS utility for converting fat-frameworks to SPM-compatible XCFramework with arm64-simulator support

Overview

xcframework-maker

swift 5.4 platform macOS SPM supported

macOS utility for converting fat-frameworks to SPM-compatible XCFramework with arm64-simulator support.

📝 Description

make-xcframework is a simple command-line utility written in Swift that creates XCFramework file from fat framework files. The resulting XCFramework file can be added as a dependency to your Swift Package, using .binaryTarget (read more in official documentation).

Optionally, arm64-simulator support can be included in the resulting XCFramework to allow development on a computer with Apple Silicon (M1) processor without a need to run Xcode through Rosetta.

The xcframework-maker Swift Package contains make-xcframework that can be used from the command line and XCFrameworkMaker library that you can integrate with your Swift Package and use programmatically.

Note: arm64-to-sim is used to "hack" the native (device) arm64 architecture slice so it can be used in a simulator running on Apple Silicon. This is an experimental feature, and it can fail for many reasons. It was tested and proved to be working with the GoogleInteractiveMediaAds dynamic fat framework, but your experience may vary.

🛠 Build

Use Swift 5.4 for building the utility on macOS:

swift build -c release

You can copy the executable or run it directly from the build directory:

.build/release/make-xcframework

▶️ Usage

OVERVIEW: Utility for creating XCFramework from legacy fat-framework files.

Use this tool to create XCFramework from legacy fat-framework files. Resulting XCFramework can be
added as a dependency to your Swift Package. Optionally arm64-simulator support can be included in
the resulting XCFramework, so it can be used on M1 Mac without the need to run Xcode through
Rosetta.

USAGE: make-xcframework [-ios <path>] [-tvos <path>] [-arm64sim] -output <path> [-verbose]

OPTIONS:
  -ios <path>             iOS input framework path.
        Provide a path to the iOS fat framework that should be included in the resulting
        XCFramework. Eg "path/to/iOS/Framework.framework"
  -tvos <path>            tvOS input framework path.
        Provide a path to the tvOS fat framework that should be included in the resulting
        XCFramework. Eg "path/to/tvOS/Framework.framework"
  -arm64sim               Add support for arm64 simulator.
        Use device-arm64 architecture slice as a simulator-arm64 architecture slice and include it
        the resulting XCFramework. This makes development possible on M1 Mac without using Rosetta.
  -output <path>          Output directory path.
        Provide a path to a directory where the resulting XCFramework should be created. Eg
        "path/to/output/directory"
  -verbose                Log detailed info to standard output.
        When this flag is provided, detailed information about each performed action is logged to
        standard output.
  -help, -h               Show help information.

Example - GoogleInteractiveMediaAds

  1. Download GoogleInteractiveMediaAds fat-frameworks from Google website:

  2. Unzip downloaded files.

  3. Run make-xcframework:

    make-xcframework \
      -ios path/to/ios/GoogleInteractiveMediaAds.framework \
      -tvos path/to/tvos/GoogleInteractiveMediaAds.framework \
      -arm64sim \
      -output output/path
  4. Resulting XCFramework will be created in the provided output directory:

    output/path/GoogleInteractiveMediaAds.xcframework

☕️ Do you like the project?

Buy Me A Coffee

📄 License

Copyright © 2021 Dariusz Rybicki Darrarski

License: MIT

You might also like...
A tiny macOS utility to foster sustainable OSS

SustainableOSS SustainableOSS is a status bar app for macOS that indexes the third-party dependencies your projects depend on, sorts them by usage, an

This is a Swift package with support for macOS that allows to start Java Jar's with the default or a custom JVM.

Jar.swift jar runner for macos Jar.swift is created and maintaned with ❥ by Sascha Muellner. What? This is a Swift package with support for macOS that

A drop-in `NSComboButton` replacement with pre macOS 13 support.
A drop-in `NSComboButton` replacement with pre macOS 13 support.

DSFComboButton A drop-in NSComboButton replacement control with pre macOS 13 support. For when you want to adopt NSComboButton but have to maintain co

A utility that reminds your iPhone app's users to review the app written in pure Swift.
A utility that reminds your iPhone app's users to review the app written in pure Swift.

SwiftRater SwiftRater is a class that you can drop into any iPhone app that will help remind your users to review your app on the App Store/in your ap

A utility to generate PreviewDevice presets from the available devices

SwiftUIGen A utility to generate PreviewDevice presets from the available devices Installation Manual Go to the GitHub page for the latest release Dow

A simple Swift utility for producing pseudolocalized strings.
A simple Swift utility for producing pseudolocalized strings.

Build your App UI to adapt and respond to translations, and find localization bugs!

Utility to run the SPI-Server tests as a benchmark

spi-benchmark This package comprises a simple tool to run the SwiftPackageIndex-Server tests in a loop, logging the run times. The purpose is to colle

Simple utility for only executing code every so often.

Rate Limit Simple utility for only executing code every so often. This will only execute the block passed for a given name if the last time it was cal

Utility functions for validating IBOutlet and IBAction connections
Utility functions for validating IBOutlet and IBAction connections

Outlets Utility functions for validating IBOutlet and IBAction connections. About Outlets provides a set of functions which validate that IBOutlets ar

Comments
  • This arm64 binary already contains an `LC_BUILD_VERSION` load command

    This arm64 binary already contains an `LC_BUILD_VERSION` load command

    Using make-xcframework works great from my fat framework without the -arm64sim flag.

    However I'm unable to generate with the -arm64sim flag. The following output occurs:

    Error: This arm64 binary already contains an LC_BUILD_VERSION load command!
    

    When using arm64-to-sim on the device arm64 framework:

    Swift/ErrorType.swift:200: Fatal error: Error raised at top level: Arm64ToSim.LcBuildVersionCommandAlreadyExistError()
    
    opened by markst 2
  • "The file is not a correct arm64 binary" - LoginWithAmazon.framework

    Thanks for an awesome tool!

    I am trying to convert the LoginWithAmazon.framework using the following parameters:

    .build/release/make-xcframework  \
      -ios LoginWithAmazon.framework \          
      -arm64sim \
      -output \output
    

    and then I receive the following output: Error: The file is not a correct arm64 binary. Try thinning (via lipo) or unarchiving (via ar) first.

    Do you have any tips on how to proceed, if it is even possible?

    wontfix 
    opened by anfriis 1
Releases(v1.1.0)
Owner
Dariusz Rybicki
Software Engineer, iOS & Mac Developer, Scrum Master
Dariusz Rybicki
Experimental iOS Arm64 hooking

ClownHook Experimental hooking on Arm64. Status Experimenting Setup Install xcodegen to generate an Xcode project. brew install xcodegen Create the X

AeonLucid 8 Jun 15, 2022
MetricTime is designed to be one universal timekeeping system that eliminates the hassle of calculating time since most of its convertions as simple as converting meters to centimeters

MetricTime MetricTime is designed to be one universal timekeeping system that eliminates the hassle of calculating time since most of its convertions

Adrian Edwards 4 Feb 10, 2022
A Swift library for converting to and from opus/ogg format

swift-ogg This library provides a very simple API to convert between opus/ogg and MPEG4AAC/m4a files. It uses opus's libopus libogg to convert between

Element 13 Dec 31, 2022
Enzyme is a spm package for the make easier development on iOS

Enzyme Enzyme is a spm package for the make easier development on iOS. Installation For the installation you just need to add the url of the project t

Ebubekir 2 Jan 20, 2022
WholesomeExtensions - A SPM package that provides some extensions that I like to use

WholesomeExtensions This package includes some extensions that I like to use. Yo

Fırat Yenidünya 2 Dec 30, 2022
Swift-DocC is a documentation compiler for Swift frameworks and packages aimed at making it easy to write and publish great developer documentation.

Swift-DocC is a documentation compiler for Swift frameworks and packages aimed at making it easy to write and publish great developer docum

Apple 833 Jan 3, 2023
Backward compatible async/await for URLSession!

URLSessionBackport URLSessionBackport aims to make it possible to use URLSession's new async/await syntax on older OSs, namely iOS 13 or macOS 10.15 a

Mochi Development, Inc. 39 Sep 21, 2022
MiniKeePass provides secure password storage on your phone that's compatible with KeePass.

MiniKeePass MiniKeePass provides secure password storage on your phone that's compatible with KeePass. View, Edit, and Create KeePass 1.x and 2.x file

null 896 Dec 14, 2022
Simple utility to change macOS Big Sur menu bar color by appending a solid color or gradient rectangle to a wallpaper image

Change menu bar color in macOS Big Sur Simple utility to change macOS Big Sur menu bar color by appending a solid color or gradient rectangle to a wal

Igor Kulman 876 Jan 5, 2023
A simple macOS utility that can be used to control the behaviour of Bose QC35 Headphones straight from the menu bar.

bose-macos-utility A simple macOS utility that can be used to control the behaviour of Bose QC35 Headphones straight from the menu bar. Why Have you e

Łukasz Zalewski 11 Aug 26, 2022