Skip to content

Commit 84305a5

Browse files
committed
feat: modify template to use SwiftUI
1 parent c1ed372 commit 84305a5

File tree

8 files changed

+42
-112
lines changed

8 files changed

+42
-112
lines changed

packages/react-native/template/visionos/HelloWorld.xcodeproj/project.pbxproj

Lines changed: 11 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,10 @@
99
/* Begin PBXBuildFile section */
1010
00E356F31AD99517003FC87E /* HelloWorldTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 00E356F21AD99517003FC87E /* HelloWorldTests.m */; };
1111
0C80B921A6F3F58F76C31292 /* libPods-HelloWorld.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 5DCACB8F33CDC322A6C60F78 /* libPods-HelloWorld.a */; };
12-
13B07FBC1A68108700A75B9A /* AppDelegate.mm in Sources */ = {isa = PBXBuildFile; fileRef = 13B07FB01A68108700A75B9A /* AppDelegate.mm */; };
1312
13B07FBF1A68108700A75B9A /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 13B07FB51A68108700A75B9A /* Images.xcassets */; };
14-
13B07FC11A68108700A75B9A /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 13B07FB71A68108700A75B9A /* main.m */; };
13+
767CEB962B56C0F3000139AD /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 767CEB952B56C0F3000139AD /* AppDelegate.swift */; };
14+
767CEB982B56C0FA000139AD /* App.swift in Sources */ = {isa = PBXBuildFile; fileRef = 767CEB972B56C0FA000139AD /* App.swift */; };
1515
7699B88040F8A987B510C191 /* libPods-HelloWorld-HelloWorldTests.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 19F6CBCC0A4E27FBF8BF4A61 /* libPods-HelloWorld-HelloWorldTests.a */; };
16-
81AB9BB82411601600AC10FF /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 81AB9BB72411601600AC10FF /* LaunchScreen.storyboard */; };
1716
/* End PBXBuildFile section */
1817

1918
/* Begin PBXContainerItemProxy section */
@@ -31,17 +30,15 @@
3130
00E356F11AD99517003FC87E /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
3231
00E356F21AD99517003FC87E /* HelloWorldTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = HelloWorldTests.m; sourceTree = "<group>"; };
3332
13B07F961A680F5B00A75B9A /* HelloWorld.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = HelloWorld.app; sourceTree = BUILT_PRODUCTS_DIR; };
34-
13B07FAF1A68108700A75B9A /* AppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AppDelegate.h; path = HelloWorld/AppDelegate.h; sourceTree = "<group>"; };
35-
13B07FB01A68108700A75B9A /* AppDelegate.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = AppDelegate.mm; path = HelloWorld/AppDelegate.mm; sourceTree = "<group>"; };
3633
13B07FB51A68108700A75B9A /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; name = Images.xcassets; path = HelloWorld/Images.xcassets; sourceTree = "<group>"; };
3734
13B07FB61A68108700A75B9A /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = Info.plist; path = HelloWorld/Info.plist; sourceTree = "<group>"; };
38-
13B07FB71A68108700A75B9A /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = main.m; path = HelloWorld/main.m; sourceTree = "<group>"; };
3935
19F6CBCC0A4E27FBF8BF4A61 /* libPods-HelloWorld-HelloWorldTests.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-HelloWorld-HelloWorldTests.a"; sourceTree = BUILT_PRODUCTS_DIR; };
4036
3B4392A12AC88292D35C810B /* Pods-HelloWorld.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-HelloWorld.debug.xcconfig"; path = "Target Support Files/Pods-HelloWorld/Pods-HelloWorld.debug.xcconfig"; sourceTree = "<group>"; };
4137
5709B34CF0A7D63546082F79 /* Pods-HelloWorld.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-HelloWorld.release.xcconfig"; path = "Target Support Files/Pods-HelloWorld/Pods-HelloWorld.release.xcconfig"; sourceTree = "<group>"; };
4238
5B7EB9410499542E8C5724F5 /* Pods-HelloWorld-HelloWorldTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-HelloWorld-HelloWorldTests.debug.xcconfig"; path = "Target Support Files/Pods-HelloWorld-HelloWorldTests/Pods-HelloWorld-HelloWorldTests.debug.xcconfig"; sourceTree = "<group>"; };
4339
5DCACB8F33CDC322A6C60F78 /* libPods-HelloWorld.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-HelloWorld.a"; sourceTree = BUILT_PRODUCTS_DIR; };
44-
81AB9BB72411601600AC10FF /* LaunchScreen.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; name = LaunchScreen.storyboard; path = HelloWorld/LaunchScreen.storyboard; sourceTree = "<group>"; };
40+
767CEB952B56C0F3000139AD /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = AppDelegate.swift; path = VisionAppTestSUI/AppDelegate.swift; sourceTree = "<group>"; };
41+
767CEB972B56C0FA000139AD /* App.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = App.swift; path = VisionAppTestSUI/App.swift; sourceTree = "<group>"; };
4542
89C6BE57DB24E9ADA2F236DE /* Pods-HelloWorld-HelloWorldTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-HelloWorld-HelloWorldTests.release.xcconfig"; path = "Target Support Files/Pods-HelloWorld-HelloWorldTests/Pods-HelloWorld-HelloWorldTests.release.xcconfig"; sourceTree = "<group>"; };
4643
ED297162215061F000B7C4FE /* JavaScriptCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = JavaScriptCore.framework; path = System/Library/Frameworks/JavaScriptCore.framework; sourceTree = SDKROOT; };
4744
/* End PBXFileReference section */
@@ -86,12 +83,10 @@
8683
13B07FAE1A68108700A75B9A /* HelloWorld */ = {
8784
isa = PBXGroup;
8885
children = (
89-
13B07FAF1A68108700A75B9A /* AppDelegate.h */,
90-
13B07FB01A68108700A75B9A /* AppDelegate.mm */,
86+
767CEB952B56C0F3000139AD /* AppDelegate.swift */,
87+
767CEB972B56C0FA000139AD /* App.swift */,
9188
13B07FB51A68108700A75B9A /* Images.xcassets */,
9289
13B07FB61A68108700A75B9A /* Info.plist */,
93-
81AB9BB72411601600AC10FF /* LaunchScreen.storyboard */,
94-
13B07FB71A68108700A75B9A /* main.m */,
9590
);
9691
name = HelloWorld;
9792
sourceTree = "<group>";
@@ -241,7 +236,6 @@
241236
isa = PBXResourcesBuildPhase;
242237
buildActionMask = 2147483647;
243238
files = (
244-
81AB9BB82411601600AC10FF /* LaunchScreen.storyboard in Resources */,
245239
13B07FBF1A68108700A75B9A /* Images.xcassets in Resources */,
246240
);
247241
runOnlyForDeploymentPostprocessing = 0;
@@ -392,8 +386,8 @@
392386
isa = PBXSourcesBuildPhase;
393387
buildActionMask = 2147483647;
394388
files = (
395-
13B07FBC1A68108700A75B9A /* AppDelegate.mm in Sources */,
396-
13B07FC11A68108700A75B9A /* main.m in Sources */,
389+
767CEB962B56C0F3000139AD /* AppDelegate.swift in Sources */,
390+
767CEB982B56C0FA000139AD /* App.swift in Sources */,
397391
);
398392
runOnlyForDeploymentPostprocessing = 0;
399393
};
@@ -484,9 +478,10 @@
484478
SUPPORTS_MACCATALYST = NO;
485479
SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = NO;
486480
SUPPORTS_XR_DESIGNED_FOR_IPHONE_IPAD = NO;
481+
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
487482
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
488483
SWIFT_VERSION = 5.0;
489-
TARGETED_DEVICE_FAMILY = "7";
484+
TARGETED_DEVICE_FAMILY = 7;
490485
VERSIONING_SYSTEM = "apple-generic";
491486
};
492487
name = Debug;
@@ -516,7 +511,7 @@
516511
SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = NO;
517512
SUPPORTS_XR_DESIGNED_FOR_IPHONE_IPAD = NO;
518513
SWIFT_VERSION = 5.0;
519-
TARGETED_DEVICE_FAMILY = "7";
514+
TARGETED_DEVICE_FAMILY = 7;
520515
VERSIONING_SYSTEM = "apple-generic";
521516
};
522517
name = Release;
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import SwiftUI
2+
import React
3+
import React_RCTSwiftExtensions
4+
5+
@main
6+
struct HelloWorldApp: App {
7+
@UIApplicationDelegateAdaptor var delegate: AppDelegate
8+
9+
var body: some Scene {
10+
WindowGroup {
11+
RCTRootViewRepresentable(moduleName: "HelloWorld", initialProps: nil)
12+
}
13+
}
14+
}

packages/react-native/template/visionos/HelloWorld/AppDelegate.h

Lines changed: 0 additions & 6 deletions
This file was deleted.

packages/react-native/template/visionos/HelloWorld/AppDelegate.mm

Lines changed: 0 additions & 31 deletions
This file was deleted.
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import UIKit
2+
import React
3+
import React_RCTAppDelegate
4+
5+
class AppDelegate: RCTAppDelegate {
6+
override func sourceURL(for bridge: RCTBridge) -> URL? {
7+
self.bundleURL()
8+
}
9+
10+
override func bundleURL() -> URL? {
11+
#if DEBUG
12+
RCTBundleURLProvider.sharedSettings().jsBundleURL(forBundleRoot: "index")
13+
#else
14+
Bundle.main.url(forResource: "main", withExtension: "jsbundle")
15+
#endif
16+
}
17+
}

packages/react-native/template/visionos/HelloWorld/Info.plist

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,6 @@
3434
</dict>
3535
<key>NSLocationWhenInUseUsageDescription</key>
3636
<string></string>
37-
<key>UILaunchStoryboardName</key>
38-
<string>LaunchScreen</string>
3937
<key>UIRequiredDeviceCapabilities</key>
4038
<array>
4139
<string>armv7</string>

packages/react-native/template/visionos/HelloWorld/LaunchScreen.storyboard

Lines changed: 0 additions & 47 deletions
This file was deleted.

packages/react-native/template/visionos/HelloWorld/main.m

Lines changed: 0 additions & 10 deletions
This file was deleted.

0 commit comments

Comments
 (0)