     // MARK: handler
     var onCompleteInitialization: ((CameraManualSetupResult) -> (Void))? = nil
     
-    private func setupWithPreview(preview:UIView) {
+    private func setupWithPreview(preview:CameraPreview) {
         let authorizationStatus = AVCaptureDevice.authorizationStatusForMediaType(AVMediaTypeVideo)
         
         switch (authorizationStatus) {

                
            } catch let error as NSError {
                NSLog("Could not create video device input: %@", error )
            }
        
        };

    // Why not do all of this on the main queue?
    // Because -[AVCaptureSession startRunning] is a blocking call which can take a long time. We dispatch session setup to the sessionQueue
    // so that the main queue isn't blocked, which keeps the UI responsive.
    private func setupCaptureSession(preview:CameraPreview) {
        
        dispatch_async(self.sessionQueue) {
            if ( self.setupResult != CameraManualSetupResult.Success ) {
