Rotate device orientation you want to.
There are several things about control of orientation,
and sometime you should have to rotate orientation you want to.
This is the code, rotate device orientation programmatically.
let orientation: UIInterfaceOrientation = .portrait // you want to...
UIDevice.current.setValue(orientation.rawValue, forKey: "orientation")
How about try some combine another orientation control code and this?