Created
July 14, 2015 12:10
-
-
Save vknabel/f81a9d89eb46a3f53ed4 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import UIKit | |
import AVFoundation | |
class CameraPreviewView: UIView { | |
override class func layerClass() -> AnyClass { | |
return AVCaptureVideoPreviewLayer.self | |
} | |
var session: AVCaptureSession! { | |
get { | |
let layer = self.layer as? AVCaptureVideoPreviewLayer | |
return layer?.session | |
} | |
set { | |
if let layer = self.layer as? AVCaptureVideoPreviewLayer { | |
layer.session = newValue | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment