jessesquires / jessesquires.com

Turing complete with a stack of 0xdeadbeef
https://www.jessesquires.com
Other
46 stars 19 forks source link

Feedback: SwiftUI app lifecycle: issues with ScenePhase and using AppDelegate adaptors #200

Closed dennisbirch closed 1 month ago

dennisbirch commented 2 months ago

1) I'm glad to see I'm not the only one experiencing this apparent oversight

2) "Unexpectedly, the main view receives onAppear() before your app receives the scene phase change. In the sample above, that would be ContentView. That’s like receiving viewWillAppear() on your root view controller before application(_:didFinishLaunchingWithOptions:) gets called."

This is exactly the behavior I ran across when trying to translate my iOS (UIKit) experience to a macOS (AppKit) project. I couldn't understand why nothing was being set up properly in my main view until I realized that viewWillAppear was being called in the ViewController before the AppDelegate's didFinishLaunching... method was called.

jessesquires commented 2 months ago

Ooof 😅 yeah sorry you're dealing with this too @dennisbirch !

I'm also glad it's not just me 😆

github-actions[bot] commented 1 month ago

Thanks so much for leaving feedback about this blog post! After 2 weeks of inactivity these issues are automatically closed, but feel free to continue the discussion!