79449520

Date: 2025-02-18 20:33:24
Score: 2
Natty:
Report link

The solution was to use it on appear, like so:

@main
struct ExampleApp: App {

    @UIApplicationDelegateAdaptor private var appDelegate: AppDelegate
    
    var body: some Scene {
        WindowGroup {
            ContentView()
                .onAppear(perform: {
                    appDelegate.app = self
                })
        }
    }
}

And inside AppDeligate it should start like this:

class AppDelegate: NSObject, UIApplicationDelegate {
    
    var app: ExampleApp?
Reasons:
  • Has code block (-0.5):
  • Ends in question mark (2):
  • Self-answer (0.5):
Posted by: TheGreatCornholio