I have this setup to observe value changes for AVCaptureDevice deviceWhiteBalanceGains:
@objc dynamic var videoDevice:AVCaptureDevice?
private var deviceWBGainsObservation: NSKeyValueObservation?
And then in the code,
deviceWBGainsObservation = videoDevice?.observe(\.deviceWhiteBalanceGains,
options: [.old, .new]) {[unowned self] (object, change) in
NSLog("\(change)")
}
Problem is change oldValue and newValue is always nil. This is not the case if I use the traditional key-value observing method observeValue(forKeypath:...)
. What am I doing wrong?