     }
   }
   
+  private func switchDeviceInput() {
+    if let _frontDeviceInput = frontDeviceInput {
+      session.beginConfiguration()
+      
+      if let _currentInput = session.inputs.first as? AVCaptureDeviceInput {
+        session.removeInput(_currentInput)
+        
+        let newDeviceInput = (_currentInput.device.position == .Front) ? defaultDeviceInput : _frontDeviceInput
+        session.addInput(newDeviceInput)
+      }
+      
+      session.commitConfiguration()
+    }
+  }
+  
   // MARK: - Controlling Reader
   
   private func startScanning() {

        }
      }
    }
    
    return nil
  }()
  private lazy var deviceInput: AVCaptureDeviceInput        = { return AVCaptureDeviceInput(device: self.defaultDevice, error: nil) }()
  private var metadataOutput: AVCaptureMetadataOutput       = AVCaptureMetadataOutput()
  private var session: AVCaptureSession                     = AVCaptureSession()
  private lazy var previewLayer: AVCaptureVideoPreviewLayer = { return AVCaptureVideoPreviewLayer(session: self.session) }()

  }
  
  func switchCameraAction(button: SwitchCameraButton) {
    switchDeviceInput()
  }
  
  // MARK: - AVCaptureMetadataOutputObjects Delegate Methods
