Error with: override public func observeValueForKeyPath

Change [NSObject:AnyObject] in the declaration to [String:AnyObject].


If the definition is copied from NSKeyValueObserving.h, your override would look like the below:

override func observeValue(forKeyPath keyPath: String?, of object: Any?, change: [NSKeyValueChangeKey : Any]?, context: UnsafeMutableRawPointer?) {
    // ...
}

Note: For methods like this one, you could usually press Cmd+Shift+O and go straight to Open Quickly... pop-up field where any definition could be copy/pasted and Xcode will search for it within the project/SDK. Watch for iOS scope in this case.