Skip to content

Commit

Permalink
Add unknown orientation variant (#411)
Browse files Browse the repository at this point in the history
  • Loading branch information
GeorgeElsham committed May 30, 2024
1 parent fcdda80 commit 5eb0558
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
6 changes: 5 additions & 1 deletion Source/Device.generated.swift
Original file line number Diff line number Diff line change
Expand Up @@ -1900,17 +1900,21 @@ extension Device {
This enum describes the state of the orientation.
- Landscape: The device is in Landscape Orientation
- Portrait: The device is in Portrait Orientation
- Unknown: The device orientation is unknown.
*/
public enum Orientation {
case landscape
case portrait
case unknown
}

public var orientation: Orientation {
if UIDevice.current.orientation.isLandscape {
return .landscape
} else {
} else if UIDevice.current.orientation.isPortrait {
return .portrait
} else {
return .unknown
}
}
}
Expand Down
6 changes: 5 additions & 1 deletion Source/Device.swift.gyb
Original file line number Diff line number Diff line change
Expand Up @@ -1180,17 +1180,21 @@ extension Device {
This enum describes the state of the orientation.
- Landscape: The device is in Landscape Orientation
- Portrait: The device is in Portrait Orientation
- Unknown: The device orientation is unknown.
*/
public enum Orientation {
case landscape
case portrait
case unknown
}

public var orientation: Orientation {
if UIDevice.current.orientation.isLandscape {
return .landscape
} else {
} else if UIDevice.current.orientation.isPortrait {
return .portrait
} else {
return .unknown
}
}
}
Expand Down

0 comments on commit 5eb0558

Please sign in to comment.