I just created a SwiftUI project in Xcode 12.5 (12E262) and changed my main App class to
import SwiftUI
class AppDelegate: UIResponder, UIApplicationDelegate {
func applicationDidFinishLaunching(_ application: UIApplication) {
print("applicationDidFinishLaunching")
}
func applicationDidBecomeActive(_ application: UIApplication) {
print("applicationDidBecomeActive")
}
func applicationDidEnterBackground(_ application: UIApplication) {
print("applicationDidEnterBackground")
}
func applicationWillEnterForeground(_ application: UIApplication) {
print("applicationWillEnterForeground")
}
func applicationWillTerminate(_ application: UIApplication) {
print("applicationWillTerminate")
}
}
@main
struct SwiftUIAppDelegateTestsApp: App {
@UIApplicationDelegateAdaptor(AppDelegate.self) var delegate
var body: some Scene {
WindowGroup {
ContentView()
}
}
}
No app delegate method is called.
Should the App Delegate listed anywhere else e.g. in the build settings or info plist?