What I'm trying to achieve is that when user presses a button, to programmatically simulate device rotation to landscape. I've this code that is working for iPhone devices but not for iPads
let value = NSNumber(integerLiteral: UIDeviceOrientation.landscapeRight.rawValue)
UIDevice.current.setValue(value, forKey: "orientation")
ViewController.attemptRotationToDeviceOrientation()
Is there a way to achieve the same on iPads?