Reputation: 977
I'm trying to lock my iPhone back facing camera's white balance to its current state but I am having trouble from the point of converting objective-c code to swift. This is the code in objective-c:
[device setWhiteBalanceMode:AVCaptureWhiteBalanceModeLocked];
this is what I thought the code in swift should look like:
captureDevice.setWhiteBalanceMode(AVCaptureWhiteBalanceMode.Locked)
and Xcode tells me this:
'AVCaptureDevice' does not have a member named 'setWhiteBalanceMode'
Upvotes: 2
Views: 1782
Reputation: 977
if captureDevice.lockForConfiguration(nil) {
var gains: AVCaptureWhiteBalanceGains = AVCaptureWhiteBalanceGainsCurrent
captureDevice.setWhiteBalanceModeLockedWithDeviceWhiteBalanceGains(gains, completionHandler:nil);
captureDevice.unlockForConfiguration()
}
Upvotes: 5