Trying to use dispatch_async in which i need a throwable call, but Swift's new error handling, and method calls are confusing me, if anyone could show me how to do this correctly, or point me in the right direction, I would greatly appreciate it.
Code:
func focusAndExposeAtPoint(point: CGPoint) {
dispatch_async(sessionQueue) {
var device: AVCaptureDevice = self.videoDeviceInput.device
do {
try device.lockForConfiguration()
if device.focusPointOfInterestSupported && device.isFocusModeSupported(AVCaptureFocusMode.AutoFocus) {
device.focusPointOfInterest = point
device.focusMode = AVCaptureFocusMode.AutoFocus
}
if device.exposurePointOfInterestSupported && device.isExposureModeSupported(AVCaptureExposureMode.AutoExpose) {
device.exposurePointOfInterest = point
device.exposureMode = AVCaptureExposureMode.AutoExpose
}
device.unlockForConfiguration()
} catch let error as NSError {
print(error)
}
}
}
Warning:
: Invalid conversion from throwing function of type '() throws -> _' to non-throwing function type '@convention(block) () -> Void'