Skip to content

fix(ffi): build Swift xcframework as dynamic frameworks - #198

Closed
Nic-dorman wants to merge 1 commit into
mainfrom
fix/ffi-swift-dynamic-xcframework
Closed

fix(ffi): build Swift xcframework as dynamic frameworks#198
Nic-dorman wants to merge 1 commit into
mainfrom
fix/ffi-swift-dynamic-xcframework

Conversation

@Nic-dorman

Copy link
Copy Markdown
Collaborator

Problem

AntFfi's Swift xcframework shipped as a static library (.a + Headers/module.modulemap). SwiftPM copies that module.modulemap into the consumer's shared BUILT_PRODUCTS_DIR/include/, so it collides with any other static xcframework that does the same — e.g. Reown AppKit's transitive yttrium framework:

error: Multiple commands produce '.../include/module.modulemap'

This blocked AntFfi from being used alongside WalletConnect (and likely other native crypto SDKs) in a single iOS app.

Fix

build-swift.sh now packages each slice as a dynamic .framework built from the cdylib:

  • modulemap lives in Modules/ (not the shared include/)
  • flat layout for iOS / simulator, versioned bundle (Versions/A + symlinks) for macOS
  • install_name_tool -id @rpath/...
  • generated Info.plist with a valid bundle id

Multiple such frameworks coexist cleanly. Consumers need no source change — the binaryTarget stays the same and SwiftPM auto-embeds the framework.

Verification

Built a demo app that links Reown AppKit against the pipeline-produced xcframework (3 slices, 41 MB): BUILD SUCCEEDED for the iPhone simulator; the module.modulemap collision count is 0.

Follow-ups (separate)

  • Re-cut the AntFfi release so ant-swift's binaryTarget url + checksum point at the dynamic xcframework.
  • The manual linkerSettings in ant-swift's Package.swift can likely be dropped now (a dynamic framework conveys its own link dependencies).

The static-library xcframework copied its `module.modulemap` into the
consumer's shared `BUILT_PRODUCTS_DIR/include/`, colliding with any other
static xcframework doing the same — notably Reown AppKit's `yttrium`:
"Multiple commands produce .../include/module.modulemap". This blocked
AntFfi from coexisting with WalletConnect (and likely other native crypto
SDKs) in one iOS app.

`build-swift.sh` now packages each slice as a DYNAMIC `.framework` built
from the cdylib (flat layout for iOS, versioned bundle for macOS): the
modulemap lives in `Modules/`, `install_name` is set to `@rpath`, and a
generated `Info.plist` carries a valid bundle id. Multiple such frameworks
coexist cleanly in one app.

Verified end-to-end: a demo app that links Reown AppKit builds for the
iPhone simulator against the pipeline-produced xcframework — collision gone.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@Nic-dorman

Copy link
Copy Markdown
Collaborator Author

Superseded — this exact build-swift.sh change (dynamic-framework xcframework packaging) already landed on main via #199 as commit 2d7475a. Verified byte-identical (empty diff between this branch's build-swift.sh and main's), and validated in production: the AntFfi v0.0.3 release was built with it. Closing as redundant; deleting the branch. (Linear V2-532 = Done.)

@Nic-dorman Nic-dorman closed this Jul 7, 2026
@Nic-dorman
Nic-dorman deleted the fix/ffi-swift-dynamic-xcframework branch July 7, 2026 08:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant