rules_apple_remote_xcframework 1.1.0Latest published 1.8mo ago
MODULE.bazel
bazel_dep(name = "rules_apple_remote_xcframework", version = "1.1.0")
README

rules_apple_remote_xcframework

A Bazel module for consuming remote or local XCFrameworks for iOS/MacOS applications.

Tested with Bazel 8.x and 9.x.

Installation

Add the following to your MODULE.bazel file:

bazel_dep(name = "rules_apple_remote_xcframework", version = "1.0.1")

remote_xcframework = use_extension(
    "@rules_apple_remote_xcframework//remote_xcframework:extensions.bzl",
    "remote_xcframework_extension",
)

remote_xcframework.xcframework(
    name = "MyRemoteFramework",
    url = "https://my.server.com/path/to/MyFramework.xcframework.zip",
    sha256 = "...",
    strip_prefix = "MyFramework-1.2.3",
)

use_repo(remote_xcframework, "MyRemoteFramework")

For a local archive on disk, use an absolute filesystem path instead of url:

remote_xcframework.xcframework(
    name = "MyLocalFramework",
    path = "/absolute/path/to/MyFramework.xcframework.zip",
    strip_prefix = "MyFramework-1.2.3",
)

use_repo(remote_xcframework, "MyLocalFramework")

This module depends on rules_apple and rules_swift and is intended for Bzlmod-based projects.

Usage

You can now depend on the downloaded framework in your swift_library or ios_application targets:

swift_library(
    name = "my_lib",
    srcs = ["..."],
    deps = [
        "@MyRemoteFramework//:MyRemoteFramework",
    ],
)

See examples/ for a working end-to-end example.

Source Types

Each remote_xcframework.xcframework(...) tag must set exactly one source:

  • url: remote archive download. sha256 is required.
  • path: absolute filesystem path to a local archive or .xcframework directory. sha256 must be omitted.

Relative paths are not supported.

Framework Types

The extension supports both dynamic and static XCFrameworks. By default, frameworks are treated as dynamic.

Dynamic Frameworks (Default)

Dynamic frameworks are the default behavior. You can omit the type attribute:

remote_xcframework.xcframework(
    name = "MyDynamicFramework",
    url = "https://my.server.com/path/to/MyDynamicFramework.xcframework.zip",
    sha256 = "...",
    strip_prefix = "MyDynamicFramework-1.0.0",
)

Or explicitly specify type = "dynamic":

remote_xcframework.xcframework(
    name = "MyDynamicFramework",
    path = "/absolute/path/to/MyDynamicFramework.xcframework.zip",
    strip_prefix = "MyDynamicFramework-1.0.0",
    type = "dynamic",
)

Static Frameworks

For static XCFrameworks, set type = "static":

remote_xcframework.xcframework(
    name = "MyStaticFramework",
    url = "https://my.server.com/path/to/MyStaticFramework.xcframework.zip",
    sha256 = "...",
    strip_prefix = "MyStaticFramework-1.0.0",
    type = "static",
)

When to use static vs dynamic frameworks:

  • Static frameworks: Linked at compile time, increase app size but may improve launch time. Best for frameworks that don't need to be shared across multiple targets.
  • Dynamic frameworks: Linked at runtime, can be shared across app extensions and the main app. Required for frameworks that need to be loaded dynamically.

Languages

Shell59.2%
Starlark40.8%

Maintainers

@saeid-rez

Versions

1.1.0 +2.2mo2026-08-14
1.0.1 +2.7mo2026-06-08
0.5.22026-03-18