From ca43421a8f941f4cc320db1cba2d2d95c696ea82 Mon Sep 17 00:00:00 2001 From: mrustaa Date: Thu, 4 Nov 2021 14:02:00 +0300 Subject: [PATCH] FixRotation: Create extension UIDeviceOrientation + Add property Boolean .isRotateAllowed, .face --- Sources/ContainerController/ContainerDevice.swift | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/Sources/ContainerController/ContainerDevice.swift b/Sources/ContainerController/ContainerDevice.swift index 897822d..7738823 100644 --- a/Sources/ContainerController/ContainerDevice.swift +++ b/Sources/ContainerController/ContainerDevice.swift @@ -120,3 +120,17 @@ open class ContainerDevice { } } } + +public extension UIDeviceOrientation { + + var isRotateAllowed: Bool { + return !(face || self == .portraitUpsideDown) + } + + var face: Bool { + switch self { + case .faceUp, .faceDown: return true + default: return false + } + } +}