From d5aefa1ee23be4d7d0e866085d064aee1284f7c9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mikl=C3=B3s=20Fazekas?= Date: Fri, 6 Mar 2026 07:19:47 +0100 Subject: [PATCH] =?UTF-8?q?fix:=20Xcode=2026=20compatibility=20=E2=80=94?= =?UTF-8?q?=20strip=20.Swift=20submodule=20from=20RiveRuntime=20modulemaps?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit RiveRuntime's prebuilt XCFramework (Swift 6.1) and locally-compiled pods (Swift 6.2) generate conflicting C++ interop type definitions, causing hard ODR errors on Xcode 26. This hooks into CocoaPods pre_install to strip the .Swift Clang submodule from RiveRuntime's modulemaps. Fixes #173 --- RNRive.podspec | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/RNRive.podspec b/RNRive.podspec index 99664968..c01a610e 100644 --- a/RNRive.podspec +++ b/RNRive.podspec @@ -30,6 +30,28 @@ end Pod::UI.puts "@rive-app/react-native: Rive iOS SDK #{rive_ios_version}" +# Xcode 26 workaround: strip .Swift Clang submodule from RiveRuntime's prebuilt +# modulemaps to prevent ODR conflicts with locally-compiled Swift C++ interop. +# See: https://github.com/rive-app/rive-nitro-react-native/issues/173 +if defined?(Pod::Installer) + module RiveXcode26SwiftModuleFix + def run_podfile_pre_install_hooks + rive_dir = File.join(sandbox.root.to_s, 'RiveRuntime') + if Dir.exist?(rive_dir) + Dir.glob(File.join(rive_dir, '**', 'module.modulemap')).each do |path| + content = File.read(path) + next unless content.include?('RiveRuntime.Swift') + cleaned = content.gsub(/\nmodule RiveRuntime\.Swift \{[^}]*\}\n?/m, "\n") + File.write(path, cleaned) + end + end + super + end + end + + Pod::Installer.prepend(RiveXcode26SwiftModuleFix) +end + Pod::Spec.new do |s| s.name = "RNRive" s.version = package["version"]