I am using code that worked with Xcode 7 Beta 2. Just got Beta 3 and now I'm getting this problem that seems like an Xcode bug?
For one of my public classes...
override public func observeValueForKeyPath...
Method does not override any method from its superclass
So I take out the "override":
public func observeValueForKeyPath
Method conflicts with method from superclass NSObject with the same Objective-C selector
ha! I was lied to by the first error. Won't compile either way. Any help please?
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.
Change [NSObject:AnyObject]
in the declaration to [String:AnyObject]
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With