The following code works for me for any orientation
func updateOrientation(orientation: UIInterfaceOrientationMask) {
if #available(iOS 16, *) {
DispatchQueue.main.async {
let windowScene = UIApplication.shared.connectedScenes.first as? UIWindowScene
self.setNeedsUpdateOfSupportedInterfaceOrientations()
self.navigationController?.setNeedsUpdateOfSupportedInterfaceOrientations()
windowScene?.requestGeometryUpdate(.iOS(interfaceOrientations: orientation)) { error in
print(error)
print(windowScene?.effectiveGeometry ?? "")
}
}
}
}