Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
b088aed
[RN][iOS] Update SwiftPM to build from source
cipolleschi Jul 29, 2025
809efff
remove git folder
cipolleschi Jul 29, 2025
f9ceef6
Fix search paths and push forward with the app
cipolleschi Jul 30, 2025
1afa272
fix swift compatibility and integrate with HelloWorld
cipolleschi Jul 31, 2025
d8421b4
implement changes in codegen to put files in the right folders
cipolleschi Aug 4, 2025
e44136c
remove ios-test-app
cipolleschi Aug 13, 2025
f7218d1
feat: add scripts to create hard links and write down instructions to…
cipolleschi Aug 14, 2025
4045243
feat: create script to prepare the app
cipolleschi Aug 14, 2025
959c27f
feat: open xcode automatically
cipolleschi Aug 14, 2025
87bda8c
remove references to swiftpm from the project.pbxproj file
cipolleschi Aug 15, 2025
bbfb22c
feat: implement modification of the Xcodeproject
cipolleschi Aug 15, 2025
51f5cbb
feat: add cleanup so that the script is idempotent
cipolleschi Aug 16, 2025
47192f9
refactor: refactor the code to use early exits for readability
cipolleschi Aug 16, 2025
64be7a1
configure yarn script
cipolleschi Aug 16, 2025
7ced933
feat: start working on converting the json to text
cipolleschi Aug 16, 2025
dce2bd3
feat: Convert back the pbxproj to a file format
cipolleschi Aug 18, 2025
4789c81
start working on integration with RNTester
cipolleschi Aug 20, 2025
8f541f0
Fix RCTRequired
cipolleschi Aug 21, 2025
59cd942
fix symlinks for React libraries
cipolleschi Aug 21, 2025
862e9b8
feat: add script command to prepare RNTester with switfpm
cipolleschi Aug 26, 2025
755750d
Add fixes for building RNTester
cipolleschi Aug 27, 2025
70718fe
feat: prepare local RNTester modules to build with SPM
cipolleschi Aug 29, 2025
2dc7755
feat: prepare RCTPushNotification to build with SPM
cipolleschi Aug 29, 2025
41afe5f
Revert changes to Package.swift for the hermes engine
cipolleschi Aug 29, 2025
0a404e0
feat: automate REACT_NATIVE_PATH and CLANG_ALLOW_NON_MODULAR_INCLUDES…
cipolleschi Aug 29, 2025
1f3f40d
fix: Fix Package.swift to properly define components and Switch
cipolleschi Aug 29, 2025
fc97e72
fix: move oscompat headers in the right place
cipolleschi Aug 29, 2025
7673911
fix: set up FBReactNativeSpec correctly
cipolleschi Aug 30, 2025
811628c
fix: add support for additional packages
cipolleschi Sep 2, 2025
98d6b0a
Restore pbxproj to main
cipolleschi Sep 2, 2025
ea34f96
fix: copy the switch headers in the right path
cipolleschi Sep 2, 2025
3850c5d
reset build from source to false
cipolleschi Sep 2, 2025
2f87d57
chore: fix lint issues
cipolleschi Sep 2, 2025
4b4f16a
fix: make ios build work in CI
cipolleschi Sep 4, 2025
b4d391b
fix: linter
cipolleschi Sep 4, 2025
db487c6
fix: update Flowtate types for js scripts, pt1
cipolleschi Sep 4, 2025
2cf4d6b
fix: fix flow checks for prepare-app and prepare-app-dependencies-hea…
cipolleschi Sep 4, 2025
11f08c2
fix: add types for xcodeproj files
cipolleschi Sep 4, 2025
c95b2e1
fix: fix codegen tests
cipolleschi Sep 4, 2025
2a21c82
remove package.swift as it is not stable
cipolleschi Sep 4, 2025
c8f0816
fix: prettier
cipolleschi Sep 4, 2025
482dda6
fix: revert BUILD_FROM_SOURCE in Package.swift
cipolleschi Sep 4, 2025
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ vendor/
# Swift Package build folder
/packages/react-native/.build
/packages/react-native/.swiftpm
/packages/react-native/React/includes/

# @react-native/codegen
/packages/react-native/React/FBReactNativeSpec/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
#import <objc/runtime.h>
#import "RCTAppSetupUtils.h"
#import "RCTDependencyProvider.h"
#import <React/RCTBridgeDelegate.h>

#if RN_DISABLE_OSS_PLUGIN_HEADER
#import <RCTTurboModulePlugin/RCTTurboModulePlugin.h>
Expand Down
39 changes: 39 additions & 0 deletions packages/react-native/Libraries/Package.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
// swift-tools-version: 6.1
// The swift-tools-version declares the minimum version of Swift required to build this package.

import PackageDescription

let package = Package(
name: "React-Libraries",
platforms: [.iOS(.v15), .macCatalyst(SupportedPlatform.MacCatalystVersion.v13)],
products: [
// Products define the executables and libraries a package produces, making them visible to other packages.
.library(
name: "PushNotification",
targets: ["PushNotification"]),
],
dependencies: [
.package(name: "React", path: "../")
],
targets: [
// Targets are the basic building blocks of a package, defining a module or a test suite.
// Targets can depend on other targets in this package and products from dependencies.
.target(
name: "PushNotification",
dependencies: ["React"],
path: "PushNotificationIOS",
exclude: ["React-RCTPushNotification.podspec", "NativePushNotificationManagerIOS.js", "PushNotificationIOS.d.ts", "PushNotificationIOS.js"],
publicHeadersPath: ".",
// cSettings: [
// .headerSearchPath("headers")
// ],
cxxSettings: [
// .headerSearchPath("headers"),
.unsafeFlags(["-std=c++20"]),
],
linkerSettings: [
.linkedFramework("Foundation")
]
),
]
)
130 changes: 99 additions & 31 deletions packages/react-native/Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
*/

import PackageDescription
import Foundation

let BUILD_FROM_SOURCE = false

/**
This is the `Package.swift` file that allows to build React Native core using Swift PM.
Expand All @@ -33,6 +36,8 @@ let RuntimeExecutorPath = "ReactCommon/runtimeexecutor" // header only target
let CallInvokerPath = "ReactCommon/callinvoker" // header only target
let ReactFBReactNativeSpecPath = "React/FBReactNativeSpec" // generated
let FBLazyVectorPath = "Libraries/FBLazyVector" // header only
let virtualViewPath = "ReactCommon/react/renderer/components/virtualview" // header only
let virtualViewExperimentalPath = "ReactCommon/react/renderer/components/virtualviewexperimental" // header only

// MARK: Prebuilt Dependencies declaration
let reactNativeDependencies = BinaryTarget(
Expand Down Expand Up @@ -373,6 +378,8 @@ let reactRuntimeApple = RNTarget(
dependencies: [.reactNativeDependencies, .jsi, .reactPerfLogger, .reactCxxReact, .rctDeprecation, .yoga, .reactRuntime, .reactRCTFabric, .reactCoreModules, .reactTurboModuleCore, .hermesPrebuilt, .reactUtils]
)

let publicHeadersPathForReactCore: String = BUILD_FROM_SOURCE ? "includes" : "."

/// React-Core.podspec
let reactCore = RNTarget(
name: .reactCore,
Expand All @@ -385,7 +392,8 @@ let reactCore = RNTarget(
linkedFrameworks: ["CoreServices"],
excludedPaths: ["Fabric", "Tests", "Resources", "Runtime/RCTJscInstanceFactory.mm", "I18n/strings", "CxxBridge/JSCExecutorFactory.mm", "CoreModules"],
dependencies: [.reactNativeDependencies, .reactCxxReact, .reactPerfLogger, .jsi, .reactJsiExecutor, .reactUtils, .reactFeatureFlags, .reactRuntimeScheduler, .yoga, .reactJsInspector, .reactJsiTooling, .rctDeprecation, .reactCoreRCTWebsocket, .reactRCTImage, .reactTurboModuleCore, .reactRCTText, .reactRCTBlob, .reactRCTAnimation, .reactRCTNetwork, .reactFabric, .hermesPrebuilt],
sources: [".", "Runtime/RCTHermesInstanceFactory.mm"]
sources: [".", "Runtime/RCTHermesInstanceFactory.mm"],
publicHeadersPath: publicHeadersPathForReactCore
)

/// React-Fabric.podspec
Expand Down Expand Up @@ -416,6 +424,7 @@ let reactFabric = RNTarget(
"components/modal",
"components/rncore",
"components/safeareaview",
"components/switch",
"components/text",
"components/textinput",
"components/textinput/platform/ios/",
Expand All @@ -428,37 +437,68 @@ let reactFabric = RNTarget(
sources: ["animations", "attributedstring", "core", "componentregistry", "componentregistry/native", "components/root", "components/view", "components/view/platform/cxx", "components/scrollview", "components/scrollview/platform/cxx", "components/legacyviewmanagerinterop", "dom", "scheduler", "mounting", "observers/events", "telemetry", "consistency", "leakchecker", "uimanager", "uimanager/consistency"]
)

/// React-RCTFabric.podspec
let reactRCTFabric = RNTarget(
name: .reactRCTFabric,
path: "React/Fabric",
dependencies: [.reactNativeDependencies, .reactCore, .reactRCTImage, .yoga, .reactRCTText, .jsi, .reactFabricComponents, .reactGraphics, .reactImageManager, .reactDebug, .reactUtils, .reactPerformanceTimeline, .reactRendererDebug, .reactRendererConsistency, .reactRuntimeScheduler, .reactRCTAnimation, .reactJsInspector, .reactJsInspectorNetwork, .reactJsInspectorTracing, .reactFabric, .reactFabricImage]
let reactFabricInputAccessory = RNTarget(
name: .reactFabricInputAccessory,
path: "ReactCommon/react/renderer/components/inputaccessory",
dependencies: [.reactNativeDependencies, .reactCore, .reactJsiExecutor, .reactTurboModuleCore, .jsi, .logger, .reactDebug, .reactFeatureFlags, .reactUtils, .reactRuntimeScheduler, .reactCxxReact, .yoga, .reactRendererDebug, .reactGraphics, .reactFabric, .reactTurboModuleBridging]
)

/// React-FabricComponents.podspec
let reactFabricComponents = RNTarget(
name: .reactFabricComponents,
path: "ReactCommon/react/renderer",
let reactFabricModal = RNTarget(
name: .reactFabricModal,
path: "ReactCommon/react/renderer/components/modal",
excludedPaths: [
"components/modal/platform/android",
"components/modal/platform/cxx",
"components/view/platform/android",
"components/view/platform/windows",
"components/view/platform/macos",
"components/switch/iosswitch/react/renderer/components/switch/MacOSSwitchShadowNode.mm",
"components/textinput/platform/android",
"components/text/platform/android",
"components/textinput/platform/macos",
"components/text/tests",
"textlayoutmanager/tests",
"textlayoutmanager/platform/android",
"textlayoutmanager/platform/cxx",
"textlayoutmanager/platform/windows",
"textlayoutmanager/platform/macos",
"conponents/rncore", // this was the old folder where RN Core Components were generated. If you ran codegen in the past, you might have some files in it that might make the build fail.
"platform/android",
"platform/cxx",
],
dependencies: [.reactNativeDependencies, .reactCore, .reactJsiExecutor, .reactTurboModuleCore, .jsi, .logger, .reactDebug, .reactFeatureFlags, .reactUtils, .reactRuntimeScheduler, .reactCxxReact, .yoga, .reactRendererDebug, .reactGraphics, .reactFabric, .reactTurboModuleBridging]
)

let reactFabricSwitch = RNTarget(
name: .reactFabricSwitch,
path: "ReactCommon/react/renderer/components/switch/iosswitch",
excludedPaths: ["react/renderer/components/switch/MacOSSwitchShadowNode.mm"],
dependencies: [.reactNativeDependencies, .reactCore, .reactJsiExecutor, .reactTurboModuleCore, .jsi, .logger, .reactDebug, .reactFeatureFlags, .reactUtils, .reactRuntimeScheduler, .reactCxxReact, .yoga, .reactRendererDebug, .reactGraphics, .reactFabric, .reactTurboModuleBridging]
)

let reactFabricSafeAreaView = RNTarget(
name: .reactFabricSafeAreaView,
path: "ReactCommon/react/renderer/components/safeareaview",
dependencies: [.reactNativeDependencies, .reactCore, .reactJsiExecutor, .reactTurboModuleCore, .jsi, .logger, .reactDebug, .reactFeatureFlags, .reactUtils, .reactRuntimeScheduler, .reactCxxReact, .yoga, .reactRendererDebug, .reactGraphics, .reactFabric, .reactTurboModuleBridging]
)

let reactFabricTextLayoutManager = RNTarget(
name: .reactFabricTextLayoutManager,
path: "ReactCommon/react/renderer/textlayoutmanager",
excludedPaths: [
"platform/android",
"platform/cxx",
"platform/windows",
"platform/macos",
"tests",
],
dependencies: [.reactNativeDependencies, .reactCore, .reactJsiExecutor, .reactTurboModuleCore, .jsi, .logger, .reactDebug, .reactFeatureFlags, .reactUtils, .reactRuntimeScheduler, .reactCxxReact, .yoga, .reactRendererDebug, .reactGraphics, .reactFabric, .reactTurboModuleBridging],
sources: ["components/inputaccessory", "components/modal", "components/safeareaview", "components/text", "components/text/platform/cxx", "components/textinput", "components/textinput/platform/ios/", "components/unimplementedview", "components/virtualview", "components/virtualviewexperimental", "textlayoutmanager", "textlayoutmanager/platform/ios", "components/switch/iosswitch"]
sources: [".", "platform/ios"]
)

let reactFabricText = RNTarget(
name: .reactFabricText,
path: "ReactCommon/react/renderer/components/text",
excludedPaths: [
"platform/android",
"tests",
],
dependencies: [.reactNativeDependencies, .reactCore, .reactJsiExecutor, .reactTurboModuleCore, .jsi, .logger, .reactDebug, .reactFeatureFlags, .reactUtils, .reactRuntimeScheduler, .reactCxxReact, .yoga, .reactRendererDebug, .reactGraphics, .reactFabric, .reactTurboModuleBridging, .reactFabricTextLayoutManager],
sources: [".", "platform/cxx"]
)

let reactFabricTextInput = RNTarget(
name: .reactFabricTextInput,
path: "ReactCommon/react/renderer/components/textinput",
excludedPaths: [
"platform/android",
],
dependencies: [.reactNativeDependencies, .reactCore, .reactJsiExecutor, .reactTurboModuleCore, .jsi, .logger, .reactDebug, .reactFeatureFlags, .reactUtils, .reactRuntimeScheduler, .reactCxxReact, .yoga, .reactRendererDebug, .reactGraphics, .reactFabric, .reactTurboModuleBridging, .reactFabricTextLayoutManager],
sources: [".", "platform/ios"]
)

/// React-FabricImage.podspec
Expand All @@ -469,6 +509,19 @@ let reactFabricImage = RNTarget(
dependencies: [.reactNativeDependencies, .reactFabric, .reactCore, .reactJsiExecutor, .reactTurboModuleCore, .jsi, .logger, .reactDebug, .reactFeatureFlags, .reactUtils, .reactRuntimeScheduler, .reactCxxReact, .yoga, .reactRendererDebug, .reactGraphics, .reactTurboModuleBridging, .reactImageManagerApple]
)

let reactFabricUnimplementedView = RNTarget(
name: .reactFabricUnimplementedView,
path: "ReactCommon/react/renderer/components/unimplementedview",
dependencies: [.reactNativeDependencies, .reactCore, .reactJsiExecutor, .reactTurboModuleCore, .jsi, .logger, .reactDebug, .reactFeatureFlags, .reactUtils, .reactRuntimeScheduler, .reactCxxReact, .yoga, .reactRendererDebug, .reactGraphics, .reactFabric, .reactTurboModuleBridging]
)

/// React-RCTFabric.podspec
let reactRCTFabric = RNTarget(
name: .reactRCTFabric,
path: "React/Fabric",
dependencies: [.reactNativeDependencies, .reactCore, .reactRCTImage, .yoga, .reactRCTText, .jsi, .reactFabricInputAccessory, .reactFabricModal, .reactFabricSafeAreaView, .reactFabricSwitch, .reactFabricText, .reactFabricTextInput, .reactFabricUnimplementedView, .reactFabricTextLayoutManager, .reactGraphics, .reactImageManager, .reactDebug, .reactUtils, .reactPerformanceTimeline, .reactRendererDebug, .reactRendererConsistency, .reactRuntimeScheduler, .reactRCTAnimation, .reactJsInspector, .reactJsInspectorNetwork, .reactJsInspectorTracing, .reactFabric, .reactFabricImage]
)

/// React-ImageManagerApple.podspec
let reactImageManagerApple = RNTarget(
name: .reactImageManagerApple,
Expand Down Expand Up @@ -573,8 +626,15 @@ let targets = [
reactCoreRCTWebsocket,
reactFabric,
reactRCTFabric,
reactFabricComponents,
reactFabricImage,
reactFabricInputAccessory,
reactFabricModal,
reactFabricSafeAreaView,
reactFabricSwitch,
reactFabricTextLayoutManager,
reactFabricText,
reactFabricTextInput,
reactFabricUnimplementedView,
reactNativeDependencies,
hermesPrebuilt,
reactJsiTooling,
Expand Down Expand Up @@ -738,12 +798,20 @@ extension String {
static let reactJsInspector = "React-jsinspector"
static let reactJsInspectorTracing = "React-jsinspectortracing"
static let reactCxxReact = "React-cxxreact"
static let reactCore = "React-Core"
static let reactCoreRCTWebsocket = "React-Core/RCTWebSocket"
static let reactCore = "React"
static let reactCoreRCTWebsocket = "React/RCTWebSocket"
static let reactFabric = "React-Fabric"
static let reactRCTFabric = "React-RCTFabric"
static let reactFabricComponents = "React-FabricComponents"

static let reactFabricImage = "React-FabricImage"
static let reactFabricInputAccessory = "React-FabricInputAccessory"
static let reactFabricModal = "React-FabricModal"
static let reactFabricSafeAreaView = "React-FabricSafeAreaView"
static let reactFabricSwitch = "React-FabricSwitch"
static let reactFabricTextLayoutManager = "React-FabricTextLayoutManager"
static let reactFabricText = "React-FabricText"
static let reactFabricTextInput = "React-FabricTextInput"
static let reactFabricUnimplementedView = "React-FabricUnimplementedView"

static let reactNativeDependencies = "ReactNativeDependencies"

Expand Down
Loading
Loading