Affected versions
Confirmed in rive_native 0.1.4 and 0.1.6 (likely all SPM-shipping versions). Pulled transitively via rive 0.14.4 / 0.14.6.
Environment
- Flutter 3.41.4 (stable)
- Xcode 26.0.1 (build 17A400)
- macOS 14, arm64
- Swift 6.2 (swiftlang-6.2.0.19.9 clang-1700.3.19.1)
- iOS deployment target 15.0
- Hybrid Flutter SPM mode (
flutter.config.enable-swift-package-manager: true in pubspec.yaml)
Bug
rive_native/ios/rive_native/Package.swift lines 1–6:
// swift-tools-version: 5.9
import PackageDescription
// Version and checksum are auto-updated by native/build_xcframework.sh
let riveNativeVersion = "0.1.6+1"
let riveNativeVersionURLComponent = riveNativeVersion.replacingOccurrences(of: "+", with: "%2B")
String.replacingOccurrences(of:with:) is a Foundation API. Swift Package Manager compiles Package.swift manifests in a minimal toolchain that does not auto-import Foundation. Result: every swift package resolve / xcodebuild -resolvePackageDependencies against a Flutter project that pulls in rive_native fails with:
error: Invalid manifest (compiled with: ["…", ".../rive_native/Package.swift", …])
.../rive_native/Package.swift:6:55: error: value of type 'String' has no member 'replacingOccurrences'
4 | // Version and checksum are auto-updated by native/build_xcframework.sh
5 | let riveNativeVersion = "0.1.6+1"
6 | let riveNativeVersionURLComponent = riveNativeVersion.replacingOccurrences(of: "+", with: "%2B")
| `- error: value of type 'String' has no member 'replacingOccurrences'
Cascading symptom (why this is hard to diagnose)
When SPM fails to compile a single plugin manifest in a Flutter FlutterGeneratedPluginSwiftPackage, the resolver bails out before walking transitive deps. The high-level error xcodebuild reports is misleading — in our case it surfaced as a fake firebase-ios-sdk version conflict:
xcodebuild: error: Could not resolve package dependencies:
Failed to resolve dependencies Dependencies could not be resolved because
'cloud_functions' depends on 'firebase-ios-sdk' 12.9.0..<13.0.0 and
root depends on 'firebase-ios-sdk' 11.7.0..<12.0.0.
The 11.7.0 pin doesn't exist anywhere in the project — it's an artifact of SPM falling back to stale resolution state when the manifest compile fails. We spent ~2 hours chasing the firebase-ios-sdk red herring before tracing the actual rive_native manifest error in swift package resolve --verbose output.
Fix (one line)
Add import Foundation to rive_native/ios/rive_native/Package.swift line 2:
// swift-tools-version: 5.9
import PackageDescription
import Foundation // ← add this
// Version and checksum are auto-updated by native/build_xcframework.sh
let riveNativeVersion = "0.1.6+1"
let riveNativeVersionURLComponent = riveNativeVersion.replacingOccurrences(of: "+", with: "%2B")
Verified locally: with import Foundation added to the pub-cache copy, xcodebuild -resolvePackageDependencies proceeds past manifest compilation and resolves the full graph successfully.
This is the same pattern other Flutter plugins use — e.g. firebase_core/ios/firebase_core/Package.swift imports both PackageDescription and Foundation since it uses String(contentsOfFile:) and NSString.path(withComponents:).
Why this matters now
Flutter 3.41+ ships SPM as a project-local opt-in (flutter.config.enable-swift-package-manager: true). With the Firebase Apple SDK CocoaPods publishing cutoff in October 2026, every Flutter+Firebase iOS app needs to migrate to SPM mode by then — and any project that pulls rive (which transitively pulls rive_native) will hit this error during their migration.
Happy to send a PR if rive-app accepts external contributions for rive_native — just let me know.
Affected versions
Confirmed in
rive_native0.1.4 and 0.1.6 (likely all SPM-shipping versions). Pulled transitively viarive0.14.4 / 0.14.6.Environment
flutter.config.enable-swift-package-manager: trueinpubspec.yaml)Bug
rive_native/ios/rive_native/Package.swiftlines 1–6:String.replacingOccurrences(of:with:)is a Foundation API. Swift Package Manager compilesPackage.swiftmanifests in a minimal toolchain that does not auto-import Foundation. Result: everyswift package resolve/xcodebuild -resolvePackageDependenciesagainst a Flutter project that pulls inrive_nativefails with:Cascading symptom (why this is hard to diagnose)
When SPM fails to compile a single plugin manifest in a Flutter
FlutterGeneratedPluginSwiftPackage, the resolver bails out before walking transitive deps. The high-level error xcodebuild reports is misleading — in our case it surfaced as a fake firebase-ios-sdk version conflict:The 11.7.0 pin doesn't exist anywhere in the project — it's an artifact of SPM falling back to stale resolution state when the manifest compile fails. We spent ~2 hours chasing the firebase-ios-sdk red herring before tracing the actual rive_native manifest error in
swift package resolve --verboseoutput.Fix (one line)
Add
import Foundationtorive_native/ios/rive_native/Package.swiftline 2:Verified locally: with
import Foundationadded to the pub-cache copy,xcodebuild -resolvePackageDependenciesproceeds past manifest compilation and resolves the full graph successfully.This is the same pattern other Flutter plugins use — e.g.
firebase_core/ios/firebase_core/Package.swiftimports bothPackageDescriptionandFoundationsince it usesString(contentsOfFile:)andNSString.path(withComponents:).Why this matters now
Flutter 3.41+ ships SPM as a project-local opt-in (
flutter.config.enable-swift-package-manager: true). With the Firebase Apple SDK CocoaPods publishing cutoff in October 2026, every Flutter+Firebase iOS app needs to migrate to SPM mode by then — and any project that pullsrive(which transitively pullsrive_native) will hit this error during their migration.Happy to send a PR if rive-app accepts external contributions for rive_native — just let me know.