Skip to content
Draft
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

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
import SwiftUI
import React
import React_RCTAppDelegate
import ReactAppDependencyProvider

@main
struct HelloWorldApp: App {
@NSApplicationDelegateAdaptor(AppDelegate.self) var appDelegate

var body: some Scene {
Window("HelloWorld", id: "main") {
ReactNativeView(factory: appDelegate.reactNativeFactory)
}
.defaultSize(width: 1280, height: 720)
}
}

// MARK: - App Delegate

class AppDelegate: NSObject, NSApplicationDelegate {
private let reactNativeDelegate: ReactNativeDelegate
let reactNativeFactory: RCTReactNativeFactory

override init() {
super.init()

let delegate = ReactNativeDelegate()
let factory = RCTReactNativeFactory(delegate: delegate)
delegate.dependencyProvider = RCTAppDependencyProvider()

reactNativeDelegate = delegate
reactNativeFactory = factory
}
Comment thread
Saadnajmi marked this conversation as resolved.
}

// MARK: - React Native Delegate

class ReactNativeDelegate: RCTDefaultReactNativeFactoryDelegate {
override func sourceURL(for bridge: RCTBridge) -> URL? {
bundleURL()
}

override func bundleURL() -> URL? {
#if DEBUG
RCTBundleURLProvider.sharedSettings().jsBundleURL(forBundleRoot: "index")
#else
Bundle.main.url(forResource: "main", withExtension: "jsbundle")
#endif
}
}

// MARK: - React Native SwiftUI View

struct ReactNativeView: NSViewRepresentable {
let factory: RCTReactNativeFactory

func makeNSView(context: Context) -> NSView {
factory.rootViewFactory.view(withModuleName: "HelloWorld")
}

func updateNSView(_ nsView: NSView, context: Context) {}
}

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,6 @@
</dict>
</dict>
</dict>
<key>NSMainStoryboardFile</key>
<string>Main</string>
<key>NSPrincipalClass</key>
<string>NSApplication</string>
<key>NSSupportsAutomaticTermination</key>
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,18 @@
objects = {

/* Begin PBXBuildFile section */
5142014D2437B4B30078DB4F /* AppDelegate.mm in Sources */ = {isa = PBXBuildFile; fileRef = 5142014C2437B4B30078DB4F /* AppDelegate.mm */; };
5142014D2437B4B30078DB4F /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5142014C2437B4B30078DB4F /* AppDelegate.swift */; };
514201522437B4B40078DB4F /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 514201512437B4B40078DB4F /* Assets.xcassets */; };
514201552437B4B40078DB4F /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 514201532437B4B40078DB4F /* Main.storyboard */; };
514201582437B4B40078DB4F /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 514201572437B4B40078DB4F /* main.m */; };

/* End PBXBuildFile section */

/* Begin PBXFileReference section */
13B07F961A680F5B00A75B9A /* HelloWorld.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = HelloWorld.app; sourceTree = BUILT_PRODUCTS_DIR; };
514201492437B4B30078DB4F /* HelloWorld.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = HelloWorld.app; sourceTree = BUILT_PRODUCTS_DIR; };
5142014B2437B4B30078DB4F /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = "<group>"; };
5142014C2437B4B30078DB4F /* AppDelegate.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = AppDelegate.mm; sourceTree = "<group>"; };
5142014C2437B4B30078DB4F /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
514201512437B4B40078DB4F /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
514201542437B4B40078DB4F /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = "<group>"; };

514201562437B4B40078DB4F /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
514201572437B4B40078DB4F /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; };
514201592437B4B40078DB4F /* HelloWorld.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = HelloWorld.entitlements; sourceTree = "<group>"; };
ED297162215061F000B7C4FE /* JavaScriptCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = JavaScriptCore.framework; path = System/Library/Frameworks/JavaScriptCore.framework; sourceTree = SDKROOT; };
/* End PBXFileReference section */
Expand Down Expand Up @@ -55,12 +52,10 @@
5142014A2437B4B30078DB4F /* HelloWorld-macOS */ = {
isa = PBXGroup;
children = (
5142014B2437B4B30078DB4F /* AppDelegate.h */,
5142014C2437B4B30078DB4F /* AppDelegate.mm */,
5142014C2437B4B30078DB4F /* AppDelegate.swift */,

514201512437B4B40078DB4F /* Assets.xcassets */,
514201532437B4B40078DB4F /* Main.storyboard */,
514201562437B4B40078DB4F /* Info.plist */,
514201572437B4B40078DB4F /* main.m */,
514201592437B4B40078DB4F /* HelloWorld.entitlements */,
);
path = "HelloWorld-macOS";
Expand Down Expand Up @@ -159,7 +154,6 @@
hasScannedForEncodings = 0;
knownRegions = (
en,
Base,
);
mainGroup = 83CBB9F61A601CBA00E9B192;
productRefGroup = 83CBBA001A601CBA00E9B192 /* Products */;
Expand All @@ -185,7 +179,6 @@
buildActionMask = 2147483647;
files = (
514201522437B4B40078DB4F /* Assets.xcassets in Resources */,
514201552437B4B40078DB4F /* Main.storyboard in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down Expand Up @@ -282,24 +275,13 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
514201582437B4B40078DB4F /* main.m in Sources */,
5142014D2437B4B30078DB4F /* AppDelegate.mm in Sources */,

5142014D2437B4B30078DB4F /* AppDelegate.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXSourcesBuildPhase section */

/* Begin PBXVariantGroup section */
514201532437B4B40078DB4F /* Main.storyboard */ = {
isa = PBXVariantGroup;
children = (
514201542437B4B40078DB4F /* Base */,
);
name = Main.storyboard;
sourceTree = "<group>";
};
/* End PBXVariantGroup section */

/* Begin XCBuildConfiguration section */
13B07F941A680F5B00A75B9A /* Debug */ = {
isa = XCBuildConfiguration;
Expand Down
Loading