Skip to content

feat(ios): consume rive-ios through Swift Package Manager - #400

Open
mfazekas wants to merge 6 commits into
mainfrom
claude/spm-rive-ios-integration-6a19e0
Open

mfazekas wants to merge 6 commits into
mainfrom
claude/spm-rive-ios-integration-6a19e0

Conversation

@mfazekas

Copy link
Copy Markdown
Collaborator

CocoaPods trunk goes read-only on 2026-12-02, and rive-ios 6.25.0 and 6.27.0 never made it there. RNRive now pulls RiveRuntime with React Native's spm_dependency from the rive-ios GitHub release, pinned to the same runtimeVersions.ios / RiveRuntimeIOSVersion.

spm_dependency links the dynamic RiveRuntime.framework but never embeds it, so apps crash at launch with Library not loaded: @rpath/RiveRuntime.framework. ios/rive_spm_embed.rb adds it to CocoaPods' embed script after installation, and does nothing if something else already embeds it (so it stays compatible with a future react-native that embeds SPM frameworks itself). No Podfile changes needed for consumers.

Xcode also processes RiveRuntime.xcframework twice (app and RNRive pod target), and Xcode 26 archives fail on the duplicate RiveRuntime.xcframework-ios.signature ("already exists", exit 70). A script phase removes the pod-level copy, same fix as maplibre-react-native#1490.

Tested on the example app (new and legacy backends, static/dynamic frameworks, Release archive) and expo57-example.

CocoaPods trunk goes read-only on 2026-12-02 and recent rive-ios releases
(6.25.0, 6.27.0) never reached it. RNRive now pulls RiveRuntime with React
Native's spm_dependency from the rive-ios GitHub release, pinned to the same
runtimeVersions.ios.

spm_dependency links but never embeds the dynamic RiveRuntime.framework, so
the podspec also patches CocoaPods' embed script after installation (and
steps aside if something already embeds it), and removes the duplicate
xcframework signature that fails Xcode 26 archives.
Recognize the install_spm_frameworks call that a react-native with
built-in spm_dependency embedding adds for RNRive, and mark the signature
cleanup phase as always out of date to silence Xcode's warning.
React Native 0.87 builds static library pods using spm_dependency into the
shared products dir (react/react-native#57602), so RNRive's build dir holds
the only copy of the signature; only remove it when RNRive has a separate
build dir. Embed RiveRuntime from the shared products dir, where Xcode copies
it with either layout.
@mfazekas
mfazekas force-pushed the claude/spm-rive-ios-integration-6a19e0 branch from a3f378c to ab39d5b Compare October 13, 2026 21:10
@mfazekas
mfazekas requested a review from dskuza October 13, 2026 21:10
…ynamic

CocoaPods only creates the [CP] Embed Pods Frameworks phase when an app has a
dynamic pod framework, so JSC apps without one never embedded RiveRuntime and
crashed at launch. Add RiveRuntime to the aggregate target's framework paths
instead of patching the generated script, skip it when react-native's
spm_dependency embeds it into an existing script, and warn when it is missing.
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