Skip to content
Closed
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
68 changes: 68 additions & 0 deletions package/Package.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
// swift-tools-version: 6.0
import PackageDescription

// Swift Package Manager support for React Native's SwiftPM autolinking
// (react-native >= 0.87, `npx react-native spm`). CocoaPods users are unaffected:
// react-native-slider.podspec stays the source of truth there.
//
// The two React Native packages are resolved by the autolinker relative to
// build/generated/autolinking/libs/react-native-slider in the app, as in
// react-native-safe-area-context. They do not resolve in a bare clone.
let package = Package(
name: "react-native-slider",
platforms: [.iOS("15.1")],
products: [
.library(name: "react-native-slider", targets: ["react-native-slider"]),
],
dependencies: [
.package(name: "ReactNative", path: "../../../../xcframeworks"),
.package(name: "React-GeneratedCode", path: "../../../ios"),
],
targets: [
.target(
name: "react-native-slider",
dependencies: [
.product(name: "ReactHeaders", package: "ReactNative"),
.product(name: "ReactNativeHeaders", package: "ReactNative"),
.product(name: "ReactNativeDependenciesHeaders", package: "ReactNative"),
.product(name: "ReactAppHeaders", package: "React-GeneratedCode"),
],
path: ".",
exclude: [
"ios/RNCSlider.xcodeproj",
],
sources: [
"ios",
"common/cpp",
],
publicHeadersPath: "ios",
cSettings: [
.headerSearchPath("ios"),
.headerSearchPath("common/cpp"),
.headerSearchPath("common/cpp/react/renderer/components/RNCSlider"),
],
cxxSettings: [
.headerSearchPath("ios"),
.headerSearchPath("common/cpp"),
.headerSearchPath("common/cpp/react/renderer/components/RNCSlider"),
// Same flags the podspec build gets from React Native's CocoaPods setup.
.unsafeFlags([
"-DFOLLY_NO_CONFIG",
"-DFOLLY_CFG_NO_COROUTINES=1",
"-DFOLLY_MOBILE=1",
"-DFOLLY_USE_LIBCPP=1",
"-DRCT_NEW_ARCH_ENABLED=1",
"-Wno-comma",
"-Wno-shorten-64-to-32",
]),
.define("DEBUG", .when(configuration: .debug)),
.define("NDEBUG", .when(configuration: .release)),
],
linkerSettings: [
.linkedFramework("UIKit"),
.linkedFramework("Foundation"),
]
),
],
cxxLanguageStandard: .cxx20
)
8 changes: 8 additions & 0 deletions package/ios/RNCSliderComponentView.mm
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,18 @@
#import <react/renderer/components/RNCSlider/RCTComponentViewHelpers.h>
#import <React/RCTBridge+Private.h>
#import <React/RCTI18nUtil.h>
#if __has_include(<react/renderer/imagemanager/RCTImagePrimitivesConversions.h>)
#import <react/renderer/imagemanager/RCTImagePrimitivesConversions.h>
#else
#import "RCTImagePrimitivesConversions.h"
#endif
#import <React/RCTImageLoaderProtocol.h>
#import <React/RCTUtils.h>
#if __has_include(<React/RCTFabricComponentsPlugins.h>)
#import <React/RCTFabricComponentsPlugins.h>
#else
#import "RCTFabricComponentsPlugins.h"
#endif
#import "RNCSlider.h"

using namespace facebook::react;
Expand Down
3 changes: 3 additions & 0 deletions package/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,9 @@
"bracketSpacing": false,
"jsxBracketSameLine": true
},
"swiftpmConfig": {
"name": "react-native-slider"
},
"codegenConfig": {
"name": "RNCSlider",
"type": "components",
Expand Down