-
Notifications
You must be signed in to change notification settings - Fork 26
/
Copy pathAppDelegate.swift
53 lines (43 loc) · 1.81 KB
/
AppDelegate.swift
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
//
// AppDelegate.swift
// SuperwallUIKitExample
//
// Created by Yusuf Tör on 05/04/2022.
//
import UIKit
import SuperwallKit
import RevenueCat
@main // You can ignore the main thread error here ->
final class AppDelegate: UIResponder, UIApplicationDelegate {
func application(
_ application: UIApplication,
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
) -> Bool {
#warning("Replace these API keys with your own.")
// MARK: Step 1 - Create your Purchase Controller
/// Create an `RCPurchaseController()` wherever Superwall and RevenueCat are being initialized.
let purchaseController = RCPurchaseController()
// MARK: Step 2 - Configure Superwall
/// Always configure Superwall first. Pass in the `purchaseController` you just created.
Superwall.configure(
apiKey: "pk_e6bd9bd73182afb33e95ffdf997b9df74a45e1b5b46ed9c9",
purchaseController: purchaseController
)
// MARK: Step 3 – Configure RevenueCat
/// Always configure RevenueCat after Superwall
Purchases.configure(with:
.builder(withAPIKey: "appl_XmYQBWbTAFiwLeWrBJOeeJJtTql")
.with(storeKitVersion: .storeKit1)
.build()
)
// MARK: Step 4 – Sync Subscription Status
/// Keep Superwall's subscription status up-to-date with RevenueCat's.
purchaseController.syncSubscriptionStatus()
return true
}
// MARK: UISceneSession Lifecycle
func application(_ application: UIApplication, configurationForConnecting connectingSceneSession: UISceneSession, options: UIScene.ConnectionOptions) -> UISceneConfiguration {
return UISceneConfiguration(name: "Default Configuration", sessionRole: connectingSceneSession.role)
}
func application(_ application: UIApplication, didDiscardSceneSessions sceneSessions: Set<UISceneSession>) {}
}