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