1 import ExpoModulesCore
2 
3 enum ModuleOrientation: Int, Enumerable {
4   case unknown = 0
5   case portraitUp = 1
6   case portraitDown = 2
7   case landscapeLeft = 3
8   case landscapeRight = 4
9 
fromnull10   static func from (orientation interfaceOrientation: UIInterfaceOrientation) -> ModuleOrientation {
11     switch interfaceOrientation {
12     case .portrait:
13       return .portraitUp
14     case .portraitUpsideDown:
15       return .portraitDown
16     case .landscapeLeft:
17       return .landscapeLeft
18     case .landscapeRight:
19       return .landscapeRight
20     case .unknown:
21       return .unknown
22     }
23   }
24 
toInterfaceOrientationnull25   func toInterfaceOrientation() -> UIInterfaceOrientation {
26     switch self {
27     case .portraitUp:
28       return .portrait
29     case .portraitDown:
30       return .portraitUpsideDown
31     case .landscapeLeft:
32       return .landscapeLeft
33     case .landscapeRight:
34       return .landscapeRight
35     case .unknown:
36       return .unknown
37     }
38   }
39 }
40