viewWillAppear doesn't get called for windows restored as minimized

Originator:Cykelero
Number:rdar://FB13450821 Date Originated:2023-12-06
Status: Resolved:
Product:AppKit Product Version:macOS 14.1.2 (23B92)
Classification:Incorrect/Unexpected Behavior Reproducible:Yes
 
If when an app is opened, a window is minimized, then view controllers in this window won't get *any* view apparition callbacks, such as viewWillAppear. Not when the app is opened; not when the window is un-minimized; not even when the app is then hidden then shown.

This behavior happens reliably on my machine, but on a friend's, it requires opening multiple tabs in a single window.
It seems to occur more reliably in document-based apps.

To reproduce:
- In System Settings, make sure “Close windows when quitting an application” is disabled.
- In Xcode, create a new document-based app, using Storyboards and Swift
- In the view controller, add a `viewWillAppear` method with a `print` call, to keep track of when the method is called.
- Now run the app. Minimize the document window that got opened.
- Quit and relaunch the app.
- Notice that `viewWillAppear` doesn't get called at all for the restored window, no matter what you do.

Comments


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!