I fixed my version of this issue by updating the supportedInterfaceOrientations and then calling self.setNeedsUpdateOfSupportedInterfaceOrientations() wrapped in an iOS version check. My VC now behaves the same as before iOS 16 update.
// MARK: START Orientation Logic
// For iOS 16+ devices need to update `supportedInterfaceOrientations` value for
// supported orientations and then call `setNeedsUpdateOfSupportedInterfaceOrientations()`
// before app will recognize the new orientation change
var scanModeEnabled = false {
didSet {
if #available(iOS 16.0, *) {
self.setNeedsUpdateOfSupportedInterfaceOrientations()
}
}
}
override var supportedInterfaceOrientations : UIInterfaceOrientationMask {
if scanModeEnabled {
return .all
} else {
return .portrait
}
}
// This is deprecated on iOS 16 and higher
override var shouldAutorotate: Bool {
return true
}
// MARK: END Orientation Logic