Skip to content

Commit 66351f6

Browse files
Merge pull request #6 from codelathe/portraitUpsideDown_support
Add portraitUpsideDown support
2 parents a321fef + c0a3b66 commit 66351f6

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

Sources/ContainerController/ContainerDevice.swift

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import UIKit
1212
public extension ContainerDevice {
1313
enum Orientation {
1414
case portrait
15+
case portraitUpsideDown
1516
case landscapeLeft
1617
case landscapeRight
1718
}
@@ -84,7 +85,7 @@ open class ContainerDevice {
8485
switch UIDevice.current.orientation {
8586
case .landscapeLeft, .landscapeRight:
8687
portrait = false
87-
case .portrait:
88+
case .portrait, .portraitUpsideDown:
8889
portrait = true
8990
default: break
9091
}
@@ -107,6 +108,13 @@ open class ContainerDevice {
107108

108109
class public var orientation: ContainerDevice.Orientation {
109110
if isPortrait {
111+
if let statusBarOrientation = statusBarOrientation {
112+
if statusBarOrientation == .portrait {
113+
return .portrait
114+
} else if statusBarOrientation == .portraitUpsideDown {
115+
return .portraitUpsideDown
116+
}
117+
}
110118
return .portrait
111119
} else {
112120
if let statusBarOrientation = statusBarOrientation {
@@ -124,7 +132,7 @@ open class ContainerDevice {
124132
public extension UIDeviceOrientation {
125133

126134
var isRotateAllowed: Bool {
127-
return !(face || self == .portraitUpsideDown)
135+
return !face
128136
}
129137

130138
var face: Bool {

0 commit comments

Comments
 (0)