I have the following code running in Swift Playgrounds, but each time I change the orientation of the iPad, the code prints "unknown.". Am I doing something wrong or is there another way?
let orientation = UIDevice.current.orientation
switch orientation {
case .unknown:
Log("unknown.")
case .portrait:
Log("portrait.")
case .portraitUpsideDown:
Log("portraitUpsideDown.")
case .landscapeLeft:
Log("landscapeLeft.")
case .landscapeRight:
Log("landscapeRight.")
case .faceUp, .faceDown:
Log("face.")
}