From 57cfbbbf4928ba08c61c12449ae460b552633f33 Mon Sep 17 00:00:00 2001 From: Christian Falch Date: Thu, 12 Nov 2026 09:49:54 +0000 Subject: [PATCH 1/2] feat(ios): add Swift Package Manager support --- Package.swift | 56 ++++++++++++++++++++++++ package.json | 5 +++ spm-headers/RCTFabricComponentsPlugins.h | 1 + 3 files changed, 62 insertions(+) create mode 100644 Package.swift create mode 100644 spm-headers/RCTFabricComponentsPlugins.h diff --git a/Package.swift b/Package.swift new file mode 100644 index 0000000..750ab40 --- /dev/null +++ b/Package.swift @@ -0,0 +1,56 @@ +// swift-tools-version: 6.0 + +import Foundation +import PackageDescription + +// React Native resolves this package through build/generated/autolinking/libs/Ease. +let usedRootEntries: Set = ["ios", "spm-headers", "Package.swift"] +let unusedRootEntries = try! FileManager.default.contentsOfDirectory(atPath: Context.packageDirectory) + .filter { !usedRootEntries.contains($0) } + .sorted() +let iosProjects = try! FileManager.default.contentsOfDirectory( + atPath: Context.packageDirectory + "/ios" +).filter { $0.hasSuffix(".xcodeproj") }.map { "ios/" + $0 } + +let package = Package( + name: "Ease", + platforms: [.iOS("15.1")], + products: [ + .library(name: "Ease", targets: ["Ease"]), + ], + dependencies: [ + .package(name: "ReactNative", path: "../../../../xcframeworks"), + .package(name: "React-GeneratedCode", path: "../../../ios"), + ], + targets: [ + .target( + name: "Ease", + dependencies: [ + .product(name: "ReactHeaders", package: "ReactNative"), + .product(name: "ReactNativeHeaders", package: "ReactNative"), + .product(name: "ReactNativeDependenciesHeaders", package: "ReactNative"), + .product(name: "ReactAppHeaders", package: "React-GeneratedCode"), + ], + path: ".", + exclude: unusedRootEntries + iosProjects, + sources: ["ios"], + publicHeadersPath: "ios", + cSettings: [ + .define("RCT_NEW_ARCH_ENABLED", to: "1"), + .headerSearchPath("spm-headers"), + ], + cxxSettings: [ + .define("RCT_NEW_ARCH_ENABLED", to: "1"), + .headerSearchPath("spm-headers"), + .define("DEBUG", .when(configuration: .debug)), + .define("NDEBUG", .when(configuration: .release)), + ], + linkerSettings: [ + .linkedFramework("UIKit"), + .linkedFramework("Foundation"), + .linkedFramework("CoreGraphics"), + ] + ), + ], + cxxLanguageStandard: .cxx20 +) diff --git a/package.json b/package.json index 248a309..74b96e3 100644 --- a/package.json +++ b/package.json @@ -23,6 +23,8 @@ "./package.json": "./package.json" }, "files": [ + "Package.swift", + "spm-headers", "src", "lib", "android", @@ -211,5 +213,8 @@ "release-it" ], "version": "0.57.2" + }, + "swiftpmConfig": { + "name": "Ease" } } diff --git a/spm-headers/RCTFabricComponentsPlugins.h b/spm-headers/RCTFabricComponentsPlugins.h new file mode 100644 index 0000000..04d7750 --- /dev/null +++ b/spm-headers/RCTFabricComponentsPlugins.h @@ -0,0 +1 @@ +#import From eb0a9df5a242cc8bd9642a28533f21c9e69a2603 Mon Sep 17 00:00:00 2001 From: Christian Falch Date: Thu, 12 Nov 2026 13:12:45 +0000 Subject: [PATCH 2/2] docs(ios): note SwiftPM setup and set DEBUG/NDEBUG for C sources --- Package.swift | 2 ++ README.md | 6 ++++++ 2 files changed, 8 insertions(+) diff --git a/Package.swift b/Package.swift index 750ab40..ccf397a 100644 --- a/Package.swift +++ b/Package.swift @@ -38,6 +38,8 @@ let package = Package( cSettings: [ .define("RCT_NEW_ARCH_ENABLED", to: "1"), .headerSearchPath("spm-headers"), + .define("DEBUG", .when(configuration: .debug)), + .define("NDEBUG", .when(configuration: .release)), ], cxxSettings: [ .define("RCT_NEW_ARCH_ENABLED", to: "1"), diff --git a/README.md b/README.md index 8273138..d5d70e5 100644 --- a/README.md +++ b/README.md @@ -21,6 +21,12 @@ npm install react-native-ease yarn add react-native-ease ``` +### Swift Package Manager (iOS) + +The package includes a `Package.swift` for apps that use Swift Package Manager instead of CocoaPods (React Native 0.88 or newer). An app moves to Swift Package Manager with `npx react-native spm add`. After that, React Native links this package automatically, and no extra step is needed. + +The Swift Package Manager setup supports iOS only. On tvOS, use CocoaPods. + ### Migration Skill If you're already using `react-native-reanimated` or React Native's `Animated` API, this project includes an [Agent Skill](https://agentskills.io) that scans your codebase for animations that can be replaced with `react-native-ease` and migrates them automatically.