NSViewControllerRepresentable life cycle methods not correctly called on 10.15.7 (includes example)

I am conditionally showing / hiding a NSViewControllerRepresentable, and it seems the life cycle methods of the NSViewController are not called correctly:

Here is a full example: GitHub - paxos/LifeCycleBug

Expected Output:

viewDidAppear
viewDidDisappear
viewDidAppear
viewDidDisappear
...

But what I see:
Output on 10.15.7:

viewDidAppear
viewDidDisappear
viewDidDisappear
viewDidAppear
viewDidAppear
...

As mentioned, this seem to be resolved on Big Sur.
Does anyone know any good work arounds?

Terms of Service

Privacy Policy

Cookie Policy