-
Notifications
You must be signed in to change notification settings - Fork 0
/
CARTApp.swift
52 lines (46 loc) · 1.48 KB
/
CARTApp.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
//
// CARTApp.swift
// CART
//
// Created by t&a on 2022/11/17.
//
import SwiftUI
import FirebaseCore
import FirebaseDatabase
import GoogleMobileAds
import GoogleSignIn
class AppDelegate: NSObject, UIApplicationDelegate {
func application(_ application: UIApplication,
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey : Any]? = nil) -> Bool {
// Firebase
FirebaseApp.configure()
// Enable offline cache
Database.database().isPersistenceEnabled = true
// Google AdMob
GADMobileAds.sharedInstance().start(completionHandler: nil)
return true
}
// Google SignIn
func application(_ application: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey: Any]) -> Bool {
return GIDSignIn.sharedInstance.handle(url)
}
}
@main
struct CARTApp: App {
@UIApplicationDelegateAdaptor(AppDelegate.self) var delegate
var body: some Scene {
WindowGroup {
VStack(spacing:0){
HeaderView()
NavigationView{
// ログイン状態で初期ビューを分岐
if AuthManager.shared.auth.currentUser != nil {
MainTabViewView()
} else {
LoginAuthView()
}
}.navigationViewStyle(.stack).accentColor(Color("SubColor")).preferredColorScheme(.light)
}
}
}
}