Skip to content

Commit d5df36f

Browse files
committed
chore: migrate AppDelegate to Swift in typescript app
1 parent 8c78887 commit d5df36f

File tree

7 files changed

+45
-61
lines changed

7 files changed

+45
-61
lines changed
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
import UIKit
2+
import React
3+
import React_RCTAppDelegate
4+
import ReactAppDependencyProvider
5+
6+
@main
7+
class AppDelegate: RCTAppDelegate {
8+
override func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey : Any]? = nil) -> Bool {
9+
self.moduleName = "TypeScriptMessaging"
10+
self.dependencyProvider = RCTAppDependencyProvider()
11+
12+
// You can add your custom initial props in the dictionary below.
13+
// They will be passed down to the ViewController used by React Native.
14+
self.initialProps = [:]
15+
16+
return super.application(application, didFinishLaunchingWithOptions: launchOptions)
17+
}
18+
19+
override func sourceURL(for bridge: RCTBridge) -> URL? {
20+
self.bundleURL()
21+
}
22+
23+
override func bundleURL() -> URL? {
24+
#if DEBUG
25+
RCTBundleURLProvider.sharedSettings().jsBundleURL(forBundleRoot: "index")
26+
#else
27+
Bundle.main.url(forResource: "main", withExtension: "jsbundle")
28+
#endif
29+
}
30+
}

examples/TypeScriptMessaging/ios/Podfile.lock

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2351,4 +2351,4 @@ SPEC CHECKSUMS:
23512351

23522352
PODFILE CHECKSUM: 6b7a4b74915b42bfe4ffddaf67cbf5e7a2bfeab3
23532353

2354-
COCOAPODS: 1.14.3
2354+
COCOAPODS: 1.16.2
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
//
2+
// Use this file to import your target's public headers that you would like to expose to Swift.
3+
//
4+

examples/TypeScriptMessaging/ios/TypeScriptMessaging.xcodeproj/project.pbxproj

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,11 @@
99
/* Begin PBXBuildFile section */
1010
00E356F31AD99517003FC87E /* TypeScriptMessagingTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 00E356F21AD99517003FC87E /* TypeScriptMessagingTests.m */; };
1111
13B07FBF1A68108700A75B9A /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 13B07FB51A68108700A75B9A /* Images.xcassets */; };
12-
13B07FC11A68108700A75B9A /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 13B07FB71A68108700A75B9A /* main.m */; };
1312
72C03BBEBFACF7568E24E771 /* PrivacyInfo.xcprivacy in Resources */ = {isa = PBXBuildFile; fileRef = DB7FF3920C4E1943711D4118 /* PrivacyInfo.xcprivacy */; };
1413
81AB9BB82411601600AC10FF /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 81AB9BB72411601600AC10FF /* LaunchScreen.storyboard */; };
1514
9EF5CF27C9749211A8AC7089 /* libPods-TypeScriptMessaging-TypeScriptMessagingTests.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 6BAA3C937B01AB47D752A61D /* libPods-TypeScriptMessaging-TypeScriptMessagingTests.a */; };
1615
A16FE33A3F8BC8263F75E3D2 /* libPods-TypeScriptMessaging.a in Frameworks */ = {isa = PBXBuildFile; fileRef = AD55CB1742B96C31B70A1858 /* libPods-TypeScriptMessaging.a */; };
17-
B783882C2865961600C8CD42 /* AppDelegate.mm in Sources */ = {isa = PBXBuildFile; fileRef = B783882A2865958200C8CD42 /* AppDelegate.mm */; };
16+
FDA53FC12D69434C00E4CE6B /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = FDA53FC02D69434C00E4CE6B /* AppDelegate.swift */; };
1817
/* End PBXBuildFile section */
1918

2019
/* Begin PBXContainerItemProxy section */
@@ -32,21 +31,20 @@
3231
00E356F11AD99517003FC87E /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
3332
00E356F21AD99517003FC87E /* TypeScriptMessagingTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = TypeScriptMessagingTests.m; sourceTree = "<group>"; };
3433
13B07F961A680F5B00A75B9A /* TypeScriptMessaging.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = TypeScriptMessaging.app; sourceTree = BUILT_PRODUCTS_DIR; };
35-
13B07FAF1A68108700A75B9A /* AppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AppDelegate.h; path = TypeScriptMessaging/AppDelegate.h; sourceTree = "<group>"; };
3634
13B07FB01A68108700A75B9A /* AppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = AppDelegate.m; path = TypeScriptMessaging/AppDelegate.m; sourceTree = "<group>"; };
3735
13B07FB51A68108700A75B9A /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; name = Images.xcassets; path = TypeScriptMessaging/Images.xcassets; sourceTree = "<group>"; };
3836
13B07FB61A68108700A75B9A /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = Info.plist; path = TypeScriptMessaging/Info.plist; sourceTree = "<group>"; };
39-
13B07FB71A68108700A75B9A /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = main.m; path = TypeScriptMessaging/main.m; sourceTree = "<group>"; };
4037
4FA0F930E8ABB03595A82E38 /* Pods-TypeScriptMessaging-TypeScriptMessagingTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-TypeScriptMessaging-TypeScriptMessagingTests.release.xcconfig"; path = "Target Support Files/Pods-TypeScriptMessaging-TypeScriptMessagingTests/Pods-TypeScriptMessaging-TypeScriptMessagingTests.release.xcconfig"; sourceTree = "<group>"; };
4138
620701C243B59F198EC2F1DB /* Pods-TypeScriptMessaging.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-TypeScriptMessaging.release.xcconfig"; path = "Target Support Files/Pods-TypeScriptMessaging/Pods-TypeScriptMessaging.release.xcconfig"; sourceTree = "<group>"; };
4239
66651ECEBEB0D9EB7F04F16E /* Pods-TypeScriptMessaging.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-TypeScriptMessaging.debug.xcconfig"; path = "Target Support Files/Pods-TypeScriptMessaging/Pods-TypeScriptMessaging.debug.xcconfig"; sourceTree = "<group>"; };
4340
6BAA3C937B01AB47D752A61D /* libPods-TypeScriptMessaging-TypeScriptMessagingTests.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-TypeScriptMessaging-TypeScriptMessagingTests.a"; sourceTree = BUILT_PRODUCTS_DIR; };
4441
81AB9BB72411601600AC10FF /* LaunchScreen.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; name = LaunchScreen.storyboard; path = TypeScriptMessaging/LaunchScreen.storyboard; sourceTree = "<group>"; };
4542
AD55CB1742B96C31B70A1858 /* libPods-TypeScriptMessaging.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-TypeScriptMessaging.a"; sourceTree = BUILT_PRODUCTS_DIR; };
4643
B435249D19B40A8878AACC99 /* Pods-TypeScriptMessaging-TypeScriptMessagingTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-TypeScriptMessaging-TypeScriptMessagingTests.debug.xcconfig"; path = "Target Support Files/Pods-TypeScriptMessaging-TypeScriptMessagingTests/Pods-TypeScriptMessaging-TypeScriptMessagingTests.debug.xcconfig"; sourceTree = "<group>"; };
47-
B783882A2865958200C8CD42 /* AppDelegate.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; name = AppDelegate.mm; path = TypeScriptMessaging/AppDelegate.mm; sourceTree = "<group>"; };
48-
DB7FF3920C4E1943711D4118 /* PrivacyInfo.xcprivacy */ = {isa = PBXFileReference; includeInIndex = 1; name = PrivacyInfo.xcprivacy; path = TypeScriptMessaging/PrivacyInfo.xcprivacy; sourceTree = "<group>"; };
44+
DB7FF3920C4E1943711D4118 /* PrivacyInfo.xcprivacy */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xml; name = PrivacyInfo.xcprivacy; path = TypeScriptMessaging/PrivacyInfo.xcprivacy; sourceTree = "<group>"; };
4945
ED297162215061F000B7C4FE /* JavaScriptCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = JavaScriptCore.framework; path = System/Library/Frameworks/JavaScriptCore.framework; sourceTree = SDKROOT; };
46+
FDA53FC02D69434C00E4CE6B /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
47+
FDA53FC22D69434E00E4CE6B /* TypeScriptMessaging-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "TypeScriptMessaging-Bridging-Header.h"; sourceTree = "<group>"; };
5048
/* End PBXFileReference section */
5149

5250
/* Begin PBXFrameworksBuildPhase section */
@@ -89,13 +87,13 @@
8987
13B07FAE1A68108700A75B9A /* TypeScriptMessaging */ = {
9088
isa = PBXGroup;
9189
children = (
92-
13B07FAF1A68108700A75B9A /* AppDelegate.h */,
90+
FDA53FC02D69434C00E4CE6B /* AppDelegate.swift */,
9391
13B07FB01A68108700A75B9A /* AppDelegate.m */,
9492
13B07FB51A68108700A75B9A /* Images.xcassets */,
9593
13B07FB61A68108700A75B9A /* Info.plist */,
9694
81AB9BB72411601600AC10FF /* LaunchScreen.storyboard */,
97-
13B07FB71A68108700A75B9A /* main.m */,
9895
DB7FF3920C4E1943711D4118 /* PrivacyInfo.xcprivacy */,
96+
FDA53FC22D69434E00E4CE6B /* TypeScriptMessaging-Bridging-Header.h */,
9997
);
10098
name = TypeScriptMessaging;
10199
sourceTree = "<group>";
@@ -131,7 +129,6 @@
131129
83CBB9F61A601CBA00E9B192 = {
132130
isa = PBXGroup;
133131
children = (
134-
B783882A2865958200C8CD42 /* AppDelegate.mm */,
135132
13B07FAE1A68108700A75B9A /* TypeScriptMessaging */,
136133
832341AE1AAA6A7D00B99B32 /* Libraries */,
137134
00E356EF1AD99517003FC87E /* TypeScriptMessagingTests */,
@@ -211,7 +208,7 @@
211208
TestTargetID = 13B07F861A680F5B00A75B9A;
212209
};
213210
13B07F861A680F5B00A75B9A = {
214-
LastSwiftMigration = 1120;
211+
LastSwiftMigration = 1620;
215212
};
216213
};
217214
};
@@ -396,8 +393,7 @@
396393
isa = PBXSourcesBuildPhase;
397394
buildActionMask = 2147483647;
398395
files = (
399-
B783882C2865961600C8CD42 /* AppDelegate.mm in Sources */,
400-
13B07FC11A68108700A75B9A /* main.m in Sources */,
396+
FDA53FC12D69434C00E4CE6B /* AppDelegate.swift in Sources */,
401397
);
402398
runOnlyForDeploymentPostprocessing = 0;
403399
};
@@ -487,6 +483,7 @@
487483
SUPPORTED_PLATFORMS = "iphoneos iphonesimulator";
488484
SUPPORTS_MACCATALYST = NO;
489485
SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = YES;
486+
SWIFT_OBJC_BRIDGING_HEADER = "TypeScriptMessaging-Bridging-Header.h";
490487
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
491488
SWIFT_VERSION = 5.0;
492489
TARGETED_DEVICE_FAMILY = "1,2";
@@ -517,6 +514,7 @@
517514
SUPPORTED_PLATFORMS = "iphoneos iphonesimulator";
518515
SUPPORTS_MACCATALYST = NO;
519516
SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = YES;
517+
SWIFT_OBJC_BRIDGING_HEADER = "TypeScriptMessaging-Bridging-Header.h";
520518
SWIFT_VERSION = 5.0;
521519
TARGETED_DEVICE_FAMILY = "1,2";
522520
VERSIONING_SYSTEM = "apple-generic";
@@ -598,7 +596,6 @@
598596
"-DFOLLY_MOBILE=1",
599597
"-DFOLLY_USE_LIBCPP=1",
600598
"-DFOLLY_CFG_NO_COROUTINES=1",
601-
" ",
602599
);
603600
OTHER_LDFLAGS = (
604601
"$(inherited)",
@@ -682,7 +679,6 @@
682679
"-DFOLLY_MOBILE=1",
683680
"-DFOLLY_USE_LIBCPP=1",
684681
"-DFOLLY_CFG_NO_COROUTINES=1",
685-
" ",
686682
);
687683
OTHER_LDFLAGS = (
688684
"$(inherited)",

examples/TypeScriptMessaging/ios/TypeScriptMessaging/AppDelegate.h

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

examples/TypeScriptMessaging/ios/TypeScriptMessaging/AppDelegate.mm

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

examples/TypeScriptMessaging/ios/TypeScriptMessaging/main.m

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

0 commit comments

Comments
 (0)