Skip to content

Commit 5eb0558

Browse files
authored
Add unknown orientation variant (#411)
1 parent fcdda80 commit 5eb0558

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

Source/Device.generated.swift

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1900,17 +1900,21 @@ extension Device {
19001900
This enum describes the state of the orientation.
19011901
- Landscape: The device is in Landscape Orientation
19021902
- Portrait: The device is in Portrait Orientation
1903+
- Unknown: The device orientation is unknown.
19031904
*/
19041905
public enum Orientation {
19051906
case landscape
19061907
case portrait
1908+
case unknown
19071909
}
19081910

19091911
public var orientation: Orientation {
19101912
if UIDevice.current.orientation.isLandscape {
19111913
return .landscape
1912-
} else {
1914+
} else if UIDevice.current.orientation.isPortrait {
19131915
return .portrait
1916+
} else {
1917+
return .unknown
19141918
}
19151919
}
19161920
}

Source/Device.swift.gyb

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1180,17 +1180,21 @@ extension Device {
11801180
This enum describes the state of the orientation.
11811181
- Landscape: The device is in Landscape Orientation
11821182
- Portrait: The device is in Portrait Orientation
1183+
- Unknown: The device orientation is unknown.
11831184
*/
11841185
public enum Orientation {
11851186
case landscape
11861187
case portrait
1188+
case unknown
11871189
}
11881190

11891191
public var orientation: Orientation {
11901192
if UIDevice.current.orientation.isLandscape {
11911193
return .landscape
1192-
} else {
1194+
} else if UIDevice.current.orientation.isPortrait {
11931195
return .portrait
1196+
} else {
1197+
return .unknown
11941198
}
11951199
}
11961200
}

0 commit comments

Comments
 (0)