Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 58 additions & 0 deletions Package.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
// swift-tools-version: 6.0

import Foundation
import PackageDescription

// React Native resolves this package through build/generated/autolinking/libs/Ease.
let usedRootEntries: Set<String> = ["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"),
.define("DEBUG", .when(configuration: .debug)),
.define("NDEBUG", .when(configuration: .release)),
],
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
)
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
5 changes: 5 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@
"./package.json": "./package.json"
},
"files": [
"Package.swift",
"spm-headers",
"src",
"lib",
"android",
Expand Down Expand Up @@ -211,5 +213,8 @@
"release-it"
],
"version": "0.57.2"
},
"swiftpmConfig": {
"name": "Ease"
}
}
1 change: 1 addition & 0 deletions spm-headers/RCTFabricComponentsPlugins.h
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
#import <React/RCTFabricComponentsPlugins.h>
Loading