swift – Landscape mode not working after iOS 16 update

0
47


My app was working perfectly fine before ios 16 update in both modes (portrait and landscape). Since I have updated to ios 16, the landscape view is not working as it should. I am using NS Layout constraints to define all my constraints and all my app is done programmatically (no storyboards or UIKit).
Here is a little example of how I am defining my constraints:

      commonConstraints = [//my constraits here],
      wideConstraints = [//wide constraints here],
      narrowConstraints = [//narrow contraints here]

      NSLayoutConstraint.activate(commonConstraints)
    
        if view.frame.width > view.frame.height {                
           // wider than tall, so "landscape"
            NSLayoutConstraint.activate(wideConstraints)
            NSLayoutConstraint.deactivate(narrowConstraints)

        } else {
            NSLayoutConstraint.activate(narrowConstraints)
            NSLayoutConstraint.deactivate(wideConstraints)
        }