Post

Replies

Boosts

Views

Activity

Reply to App Delegate
In iOS 14 (+ iPadOS 14, Big Sur etc), we have a new way of defining the entry point to our SwiftUI app that negates the need for AppDelegate. https://developer.apple.com/documentation/swiftui/app If however you need some of the functionality that was provided by AppDelegate (i.e. instantiating something at launch), you can attach a UIApplicationDelegate class with @UIApplicationDelegateAdaptor . For example, if we wanted to configure Firebase at launch: import SwiftUI import Firebase @main struct ourApp: App {     @UIApplicationDelegateAdaptor(AppDelegate.self) var appDelegate     var body: some Scene {         WindowGroup {             ContentView()         }     } } class AppDelegate: NSObject, UIApplicationDelegate {     func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey : Any]? = nil) -> Bool {         FirebaseApp.configure()                  return true     } }
Jul ’20