fix(ffi): build Swift xcframework as dynamic frameworks - #198
Closed
Nic-dorman wants to merge 1 commit into
Closed
Conversation
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>
Collaborator
Author
|
Superseded — this exact |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
AntFfi's Swift xcframework shipped as a static library (
.a+Headers/module.modulemap). SwiftPM copies thatmodule.modulemapinto the consumer's sharedBUILT_PRODUCTS_DIR/include/, so it collides with any other static xcframework that does the same — e.g. Reown AppKit's transitiveyttriumframework:This blocked AntFfi from being used alongside WalletConnect (and likely other native crypto SDKs) in a single iOS app.
Fix
build-swift.shnow packages each slice as a dynamic.frameworkbuilt from the cdylib:Modules/(not the sharedinclude/)Versions/A+ symlinks) for macOSinstall_name_tool -id @rpath/...Info.plistwith a valid bundle idMultiple such frameworks coexist cleanly. Consumers need no source change — the
binaryTargetstays 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 SUCCEEDEDfor the iPhone simulator; themodule.modulemapcollision count is 0.Follow-ups (separate)
ant-swift'sbinaryTargeturl + checksum point at the dynamic xcframework.linkerSettingsinant-swift'sPackage.swiftcan likely be dropped now (a dynamic framework conveys its own link dependencies).