Skip to content

Commit a3d1452

Browse files
committed
chore: migrate AppDelegate to Swift
1 parent 315273b commit a3d1452

File tree

7 files changed

+119
-139
lines changed

7 files changed

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

β€Žexamples/SampleApp/ios/Podfile.lockβ€Ž

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

25852585
PODFILE CHECKSUM: 4f662370295f8f9cee909f1a4c59a614999a209d
25862586

2587-
COCOAPODS: 1.14.3
2587+
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/SampleApp/ios/SampleApp.xcodeproj/project.pbxprojβ€Ž

Lines changed: 76 additions & 84 deletions
Large diffs are not rendered by default.

β€Žexamples/SampleApp/ios/SampleApp/AppDelegate.hβ€Ž

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

β€Žexamples/SampleApp/ios/SampleApp/AppDelegate.mmβ€Ž

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

β€Žexamples/SampleApp/ios/SampleApp/main.mβ€Ž

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

0 commit comments

Comments
Β (0)