Skip to content

Commit e82c4be

Browse files
authored
fix: Xcode 26 compatibility — strip .Swift submodule from RiveRuntime modulemaps (#174)
Fixes #173 RiveRuntime's prebuilt XCFramework was built with Swift 6.1. Xcode 26 uses Swift 6.2. Both generate `.Swift` Clang submodules with different C++ interop type definitions (`swift::Optional`, `swift::String`, etc), causing hard ODR errors that can't be suppressed. This is CocoaPods-specific — SPM is unaffected because it uses `.swiftmodule` files directly. The fix hooks into CocoaPods' `pre_install` via `Module#prepend` in the podspec to strip the `.Swift` submodule from RiveRuntime's prebuilt modulemaps. This is transparent to users — no Podfile changes needed. ### Modulemap patch ```diff framework module RiveRuntime { umbrella header "RiveRuntime.h" export * module * { export * } } - -module RiveRuntime.Swift { - header "RiveRuntime-Swift.h" - requires objc -} ``` ### Build error without fix (Xcode 26.2) ``` RiveRuntime-Swift.h:3603:62: error: '(lambda ...)' has different definitions in different modules; first difference is definition in module 'RiveRuntime.Swift' found method 'operator()' with body RiveRuntime-Swift.h:3596:78: error: 'swift::Optional::init' has different definitions in different modules; definition in module 'RiveRuntime.Swift' first difference is 1st parameter with name 'some_' LocalCxxPod-Swift.h:2177:29: error: 'swift::UTF8View' has different definitions in different modules LocalCxxPod-Swift.h:1984:37: error: 'swift::String' has different definitions in different modules LocalCxxPod-Swift.h:1722:52: error: 'swift::Optional' has different definitions in different modules; first difference is definition in module 'LocalCxxPod.Swift' found method 'init' with 1st parameter named 'value' ``` ### After fix BUILD SUCCEEDED (Xcode 26.2, clean DerivedData, `pod install` + `xcodebuild`)
1 parent 9831e19 commit e82c4be

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

RNRive.podspec

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,28 @@ end
3030

3131
Pod::UI.puts "@rive-app/react-native: Rive iOS SDK #{rive_ios_version}"
3232

33+
# Xcode 26 workaround: strip .Swift Clang submodule from RiveRuntime's prebuilt
34+
# modulemaps to prevent ODR conflicts with locally-compiled Swift C++ interop.
35+
# See: https://github.com/rive-app/rive-nitro-react-native/issues/173
36+
if defined?(Pod::Installer)
37+
module RiveXcode26SwiftModuleFix
38+
def run_podfile_pre_install_hooks
39+
rive_dir = File.join(sandbox.root.to_s, 'RiveRuntime')
40+
if Dir.exist?(rive_dir)
41+
Dir.glob(File.join(rive_dir, '**', 'module.modulemap')).each do |path|
42+
content = File.read(path)
43+
next unless content.include?('RiveRuntime.Swift')
44+
cleaned = content.gsub(/\nmodule RiveRuntime\.Swift \{[^}]*\}\n?/m, "\n")
45+
File.write(path, cleaned)
46+
end
47+
end
48+
super
49+
end
50+
end
51+
52+
Pod::Installer.prepend(RiveXcode26SwiftModuleFix)
53+
end
54+
3355
Pod::Spec.new do |s|
3456
s.name = "RNRive"
3557
s.version = package["version"]

0 commit comments

Comments
 (0)