Skip to content

Support for XCFrameworks #206

@kylerjensen

Description

@kylerjensen

Note: I am willing to do some PR work to make this happen, but I want to gather some community feedback before I get started.

Describe the feature

Add support for distributing pre-built binaries for iOS using xcframeworks.

"react-native-builder-bob": {
  "source": "src",
  "output": "lib",
  "targets": [
    ["aar", {"reverseJetify": true}],
    ["commonjs", {"copyFlow": true}],
    ["xcframework", {/* additional options here */}],
    "module",
    "typescript",
  ]
}

Motivation

I'd like to see more 3rd-party libraries start distributing their RN packages using pre-built xcframework binaries for iOS. The idea here is that the more 3rd-party libraries with xcframeworks we use, the more we should expect to see a reduction in the amount of time it takes to compile a RN project and a reduction in the number of native build errors. Using XCFramewoks as a packaging mechanism also gives developers the ability to distribute libraries without exposing native source code.

Including out-of-the-box support for XCFramewoks in @callstack/react-native-builder-bob is important for a number of reasons:

  • Configuring your library to produce an xcframework is somewhat tedious to do by hand, but if this setup and configuration could be done automatically as part of npx create-react-native-library, I believe xcframeworks would begin to gain popularity in the RN community.
  • For our Android friends, the aar target has given developers much of the flexibility and advantage that XCFrameworks would provide. Implementing an xcframework target would bring the iOS side of things up to a similar level of flexibility, privacy, and performance.
  • Precompiling iOS binaries prior to distribution encourages library authors to check and test their code prior to distribution, which helps solve a somewhat common (IMHO) problem in the community of library authors inadvertently releasing code that doesn't compile or isn’t forward-compatible in the case if libraries built with Swift.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions