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

    }
  }
  
  private func configureComponents() {
    session.addOutput(metadataOutput)
    session.addInput(deviceInput)
    metadataOutput.setMetadataObjectsDelegate(self, queue: dispatch_get_main_queue())
    metadataOutput.metadataObjectTypes = [AVMetadataObjectTypeQRCode]
    previewLayer.videoGravity          = AVLayerVideoGravityResizeAspectFill

        }
      }
    }
  
    return nil
    }()
  private lazy var defaultDeviceInput: AVCaptureDeviceInput = { return AVCaptureDeviceInput(device: self.defaultDevice, error: nil) }()
  private lazy var frontDeviceInput: AVCaptureDeviceInput?  = {
    if let _frontDevice = self.frontDevice {
      return AVCaptureDeviceInput(device: _frontDevice, error: nil)
    }
    
    return nil
    }()
  private var metadataOutput: AVCaptureMetadataOutput       = AVCaptureMetadataOutput()
  private var session: AVCaptureSession                     = AVCaptureSession()
  private lazy var previewLayer: AVCaptureVideoPreviewLayer = { return AVCaptureVideoPreviewLayer(session: self.session) }()
