Skip to content

Commit

Permalink
[wip] add module maps to some RN modules to allow for swift c++ imports
Browse files Browse the repository at this point in the history
  • Loading branch information
okwasniewski committed Jan 9, 2024
1 parent 32260e7 commit e6c1b21
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 45 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,9 @@ void RCTAppSetupPrepareApp(

RCT_EXTERN_C_BEGIN

[[deprecated("Use the 3-argument overload of RCTAppSetupPrepareApp instead")]] void RCTAppSetupPrepareApp(
UIApplication *application,
BOOL turboModuleEnabled);
//[[deprecated("Use the 3-argument overload of RCTAppSetupPrepareApp instead")]] void RCTAppSetupPrepareApp(
// UIApplication *application,
// BOOL turboModuleEnabled);

UIView *RCTAppSetupDefaultRootView(
RCTBridge *bridge,
Expand Down
17 changes: 9 additions & 8 deletions packages/rn-tester/RNTester-visionOS/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,21 @@
import Foundation
import UIKit
import React
import ReactCommon
import React_RCTAppDelegate
import CxxStdlib


class AppDelegate: NSObject, UIApplicationDelegate, ObservableObject {
private var bridge: RCTBridge?

func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey : Any]? = nil) -> Bool {
// Do magic
print("application did finish launching")
let cxxString = std.string("Swift with C++")
let reactNativeConfig = facebook.react.EmptyReactNativeConfig()

return true
}

func application(_ application: UIApplication, configurationForConnecting connectingSceneSession: UISceneSession, options: UIScene.ConnectionOptions) -> UISceneConfiguration {
let sceneConfig = UISceneConfiguration(name: nil, sessionRole: connectingSceneSession.role)
sceneConfig.delegateClass = SceneDelegate.self
return sceneConfig
}
// override func sourceURL(for bridge: RCTBridge!) -> URL! {
// RCTBundleURLProvider.sharedSettings().jsBundleURL(forBundleRoot: "js/RNTesterApp.ios")
// }
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,18 @@
//

import SwiftUI
import React
//import React

struct ReactRootViewRepresentable: UIViewRepresentable {
var bridge: RCTBridge
var moduleName: String

// var bridge: RCTBridge
// var moduleName: String
//
func updateUIView(_ uiView: UIViewType, context: Context) {
// Do nothing
}

//
func makeUIView(context: Context) -> some UIView {
let rootView = RCTRootView(bridge: bridge, moduleName: moduleName, initialProperties: nil)
let rootView = UIView() //RCTRootView(bridge: bridge, moduleName: moduleName, initialProperties: nil)

return rootView
}
Expand Down
24 changes: 0 additions & 24 deletions packages/rn-tester/RNTester-visionOS/SceneDelegate.swift

This file was deleted.

6 changes: 2 additions & 4 deletions packages/rn-tester/RNTesterPods.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
763DC3802B0F824400D2C0C5 /* Preview Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 763DC37F2B0F824400D2C0C5 /* Preview Assets.xcassets */; };
76E4BB282B34909800B02A15 /* App.swift in Sources */ = {isa = PBXBuildFile; fileRef = 76E4BB272B34909800B02A15 /* App.swift */; };
76E4BB2C2B34932200B02A15 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 76E4BB2B2B34932200B02A15 /* AppDelegate.swift */; };
76E4BB2E2B34940500B02A15 /* SceneDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 76E4BB2D2B34940500B02A15 /* SceneDelegate.swift */; };
76E4BB302B34950500B02A15 /* ReactRootViewRepresentable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 76E4BB2F2B34950500B02A15 /* ReactRootViewRepresentable.swift */; };
8145AE06241172D900A3F8DA /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 8145AE05241172D900A3F8DA /* LaunchScreen.storyboard */; };
832F45BB2A8A6E1F0097B4E6 /* SwiftTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 832F45BA2A8A6E1F0097B4E6 /* SwiftTest.swift */; };
Expand Down Expand Up @@ -109,7 +108,6 @@
763DC3812B0F824400D2C0C5 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
76E4BB272B34909800B02A15 /* App.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = App.swift; sourceTree = "<group>"; };
76E4BB2B2B34932200B02A15 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
76E4BB2D2B34940500B02A15 /* SceneDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SceneDelegate.swift; sourceTree = "<group>"; };
76E4BB2F2B34950500B02A15 /* ReactRootViewRepresentable.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ReactRootViewRepresentable.swift; sourceTree = "<group>"; };
7CDA7A212644C6BB8C0D00D8 /* Pods-RNTesterIntegrationTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RNTesterIntegrationTests.release.xcconfig"; path = "Target Support Files/Pods-RNTesterIntegrationTests/Pods-RNTesterIntegrationTests.release.xcconfig"; sourceTree = "<group>"; };
8145AE05241172D900A3F8DA /* LaunchScreen.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; name = LaunchScreen.storyboard; path = RNTester/LaunchScreen.storyboard; sourceTree = "<group>"; };
Expand Down Expand Up @@ -302,7 +300,6 @@
763DC3732B0F824200D2C0C5 /* RNTester-visionOS */ = {
isa = PBXGroup;
children = (
76E4BB2D2B34940500B02A15 /* SceneDelegate.swift */,
76E4BB2B2B34932200B02A15 /* AppDelegate.swift */,
76E4BB272B34909800B02A15 /* App.swift */,
76E4BB2F2B34950500B02A15 /* ReactRootViewRepresentable.swift */,
Expand Down Expand Up @@ -895,7 +892,6 @@
76E4BB2C2B34932200B02A15 /* AppDelegate.swift in Sources */,
76E4BB282B34909800B02A15 /* App.swift in Sources */,
76E4BB302B34950500B02A15 /* ReactRootViewRepresentable.swift in Sources */,
76E4BB2E2B34940500B02A15 /* SceneDelegate.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down Expand Up @@ -1137,6 +1133,7 @@
SWIFT_EMIT_LOC_STRINGS = YES;
SWIFT_INCLUDE_PATHS = "$(inherited) \"${PODS_CONFIGURATION_BUILD_DIR}/YogaKit-visionOS\" \"${PODS_CONFIGURATION_BUILD_DIR}/YogaKit-iOS\"";
"SWIFT_INCLUDE_PATHS[arch=*]" = "$(inherited) \"${PODS_CONFIGURATION_BUILD_DIR}/YogaKit-visionOS\" \"${PODS_CONFIGURATION_BUILD_DIR}/YogaKit-iOS\"";
SWIFT_OBJC_INTEROP_MODE = objcxx;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2,7";
Expand Down Expand Up @@ -1234,6 +1231,7 @@
SWIFT_COMPILATION_MODE = wholemodule;
SWIFT_EMIT_LOC_STRINGS = YES;
SWIFT_INCLUDE_PATHS = "$(inherited) \"${PODS_CONFIGURATION_BUILD_DIR}/YogaKit-visionOS\" \"${PODS_CONFIGURATION_BUILD_DIR}/YogaKit-iOS\"";
SWIFT_OBJC_INTEROP_MODE = objcxx;
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2,7";
};
Expand Down

0 comments on commit e6c1b21

Please sign in to comment.