I locked my view in portrait, but for some reason I need to know the actual device orientation, The UIDevice.current.orientation
as documentation is saying in description Returns the physical orientation of the device.
this var sometimes works well and return real device orientation and sometimes return protrait (which is wrong, because I rotated the device to landscape). So I expect to get real device orientation (despite I locked my view to portrait), is it a wrong expectation? If not why this inconsiste behavior is happening?
Note: I tried UIDevice.current.endGeneratingDeviceOrientationNotifications()
, the result is the same.