 import UIKit
 import AVFoundation
 
+enum CaptureManagerViewfinderMode {
+    case FullScreen
+    case Window
+}
+
 class CaptureManager: NSObject {
     let previewLayer: AVCaptureVideoPreviewLayer
     var flashMode: AVCaptureFlashMode {

            completion(self.accessDeniedError())
        }
    }

    func stop(completion: (() -> Void)?) {
        dispatch_async(captureQueue) {
            if self.session.running {

                }
                self.cameraDevice.unlockForConfiguration()
            }
            
            self.session.startRunning()
            
            dispatch_async(dispatch_get_main_queue()) {
                completion(error)
            }
        }
    }
    
    private func cameraDeviceWithPosition(position: AVCaptureDevicePosition) -> AVCaptureDevice? {
        let availableCameraDevices = AVCaptureDevice.devicesWithMediaType(AVMediaTypeVideo)
        for device in availableCameraDevices as! [AVCaptureDevice] {
