From 08975badd3d78fa10bad03bf8b6d4aead5daf674 Mon Sep 17 00:00:00 2001 From: rmotygullin Date: Thu, 4 Nov 2021 14:01: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 + } + } +}