-
Notifications
You must be signed in to change notification settings - Fork 4
/
MagicWeatherApp.swift
50 lines (41 loc) · 1.38 KB
/
MagicWeatherApp.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
//
// MagicWeatherApp.swift
// Magic Weather SwiftUI
//
// Created by Cody Kerns on 1/11/21.
//
import SwiftUI
import RevenueCat
@main
struct MagicWeatherApp: App {
init() {
/* Enable debug logs before calling `configure`. */
Purchases.logLevel = .debug
/*
Initialize the RevenueCat Purchases SDK.
- `appUserID` is nil by default, so an anonymous ID will be generated automatically by the Purchases SDK.
Read more about Identifying Users here: https://docs.revenuecat.com/docs/user-ids
*/
Purchases.configure(
with: Configuration.Builder(withAPIKey: Constants.apiKey)
.with(storeKitVersion: .storeKit2)
.build()
)
/* Set the delegate to our shared instance of PurchasesDelegateHandler */
Purchases.shared.delegate = PurchasesDelegateHandler.shared
}
var body: some Scene {
WindowGroup {
ContentView()
.preferredColorScheme(.dark)
.task {
do {
// Fetch the available offerings
UserViewModel.shared.offerings = try await Purchases.shared.offerings()
} catch {
print("Error fetching offerings: \(error)")
}
}
}
}
}