mirror of
https://github.com/yattee/yattee.git
synced 2025-08-09 20:24:06 +00:00
Fix orientation on iOS 16
This commit is contained in:
@@ -32,5 +32,17 @@ struct Orientation {
|
||||
|
||||
UIDevice.current.setValue(rotateOrientation.rawValue, forKey: "orientation")
|
||||
UINavigationController.attemptRotationToDeviceOrientation()
|
||||
|
||||
if #available(iOS 16, *) {
|
||||
guard let windowScene = SafeArea.scene else { return }
|
||||
let rotateOrientationMask = rotateOrientation == .portrait ? UIInterfaceOrientationMask.portrait :
|
||||
rotateOrientation == .landscapeLeft ? .landscapeLeft :
|
||||
rotateOrientation == .landscapeRight ? .landscapeRight :
|
||||
.allButUpsideDown
|
||||
|
||||
windowScene.requestGeometryUpdate(.iOS(interfaceOrientations: rotateOrientationMask)) { error in
|
||||
print("denied rotation \(error)")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user