 
 let session = AVCaptureSession()
 
-session.sessionPreset = AVCaptureSessionPreset640x480
+session.sessionPreset = AVCaptureSession.Preset.vga640x480
 session.beginConfiguration()
 session.commitConfiguration()
 
 var input : AVCaptureDeviceInput
 if let devices : [AVCaptureDevice] = AVCaptureDevice.devices() as? [AVCaptureDevice] {
     for device in devices {
-        if device.hasMediaType(AVMediaTypeVideo) && device.supportsAVCaptureSessionPreset(AVCaptureSessionPreset640x480) {
+        if device.hasMediaType(AVMediaType.video) && device.supportsSessionPreset(AVCaptureSession.Preset.vga640x480) {
             do {
                 input = try AVCaptureDeviceInput(device: device as AVCaptureDevice) as AVCaptureDeviceInput
                 

    }
    
    let output = AVCaptureVideoDataOutput()
    output.videoSettings = [kCVPixelBufferPixelFormatTypeKey as AnyHashable: Int(kCVPixelFormatType_32BGRA)]
    output.alwaysDiscardsLateVideoFrames = true
    
    if session.canAddOutput(output) {

    PlaygroundPage.current.liveView = view
    
}

