Pattern: Missing use of block based KVO API
Issue: -
Prefer the new block based KVO API with keypaths when using Swift 3.2 or later.
Examples of correct code:
let observer = foo.observe(\.value, options: [.new]) { (foo, change) in
print(change.newValue)
}
Examples of incorrect code:
class Foo: NSObject {
override ↓func observeValue(forKeyPath keyPath: String?, of object: Any?,
change: [NSKeyValueChangeKey : Any]?,
context: UnsafeMutableRawPointer?) {}
}
class Foo: NSObject {
override ↓func observeValue(forKeyPath keyPath: String?, of object: Any?,
change: Dictionary<NSKeyValueChangeKey, Any>?,
context: UnsafeMutableRawPointer?) {}
}