From 0c4b65f8aaac341ab77c803be1fcd544f7899e4c Mon Sep 17 00:00:00 2001 From: Jon Andersen Date: Thu, 7 Sep 2017 17:10:01 -0400 Subject: [PATCH] Remove protocol for orientation mode --- Source/Orientation.swift | 12 +++--------- Source/SwiftyCamViewController.swift | 8 ++++++-- 2 files changed, 9 insertions(+), 11 deletions(-) diff --git a/Source/Orientation.swift b/Source/Orientation.swift index de74816..0611d22 100644 --- a/Source/Orientation.swift +++ b/Source/Orientation.swift @@ -17,17 +17,11 @@ import Foundation import AVFoundation import UIKit -protocol Orientation: class { - func getPreviewLayerOrientation() -> AVCaptureVideoOrientation - func getVideoOrientation() -> AVCaptureVideoOrientation? - func getImageOrientation(forCamera: SwiftyCamViewController.CameraSelection) -> UIImageOrientation - func start() - func stop() -} -class DeviceOrientation : Orientation { - var deviceOrientation : UIDeviceOrientation? +class Orientation { + private var deviceOrientation : UIDeviceOrientation? var shouldUseDeviceOrientation: Bool = false + func start() { self.deviceOrientation = UIDevice.current.orientation diff --git a/Source/SwiftyCamViewController.swift b/Source/SwiftyCamViewController.swift index 9234bdc..36c6695 100644 --- a/Source/SwiftyCamViewController.swift +++ b/Source/SwiftyCamViewController.swift @@ -145,7 +145,11 @@ open class SwiftyCamViewController: UIViewController { /// Sets wether the taken photo or video should be oriented according to the device orientation - public var shouldUseDeviceOrientation = false + public var shouldUseDeviceOrientation = false { + didSet { + orientation.shouldUseDeviceOrientation = shouldUseDeviceOrientation + } + } /// Sets whether or not View Controller supports auto rotation @@ -245,7 +249,7 @@ open class SwiftyCamViewController: UIViewController { /// Last changed orientation - var orientation : Orientation = DeviceOrientation() + var orientation = Orientation() /// Boolean to store when View Controller is notified session is running