-1

since the release of the new macOS Moterey operating system (12) my MacCatalyst application does not load some views at startup until I resize the window or change focus.

If I look at XCode's Debug View Hierarchy these views are not present.

If, on the other hand, I use the classic debug (while they are not shown) it turns out that they have the correct frame (origin and size), superviews and window.

To show them I have to resize the window (manually, using the mouse) or remove the focus from the app (for example by clicking on another window and then clicking the app window again).

Only after doing one of these two things are the views loaded.

Has anyone experienced the same behavior? The application is developed in Swift only with UIKit and various Storyboards (without SwiftUI).

Thanks a lot to everyone.

Meroelyth
  • 5,310
  • 9
  • 42
  • 52
  • Provide a [mcve] please. – matt Jan 27 '22 at 08:14
  • @matt Thanks for the reply. I tried to create a minimal reproducible example but couldn't. Maybe it's the result of a combination of all my views. I'm 100% sure the users and I didn't have this problem before Monterey. – Meroelyth Jan 27 '22 at 08:55

1 Answers1

0

I understand what happens.  If it can be useful to anyone ... 

I use custom margins for my UIViewControllers. To calculate a margin, I use the minimum width of a scene as a variable.

I take this value in this way: 

var minSceneWidth:CGFloat = 400
scenes.forEach { windowScene in
    if let w = windowScene.sizeRestrictions?.minimumSize.width {
        if minSceneWidth > w {
            minSceneWidth = w
        }
    }
}

Since the latest version of macOS the value "minimumSize.width" seems to be also "0" and this is not good for the calculation of my margins. 

Thank you all.

Meroelyth
  • 5,310
  • 9
  • 42
  • 52