-
Notifications
You must be signed in to change notification settings - Fork 283
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add removeObserver:forKeyPath:context: to implementation #323
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The interface looks fine.
I think we have two options for the implementation:
- raise an exception to say that the method is not yet implemented.
- implement the method to do what it's supposed to.
Implementing it as a synonym for -removeObjecter:forKeyPath: is IMO wrong since that would mean the app silently misbehaves.
I am not sure what the proper implementation is. I don't know what should be done with the "context" parameter. |
I'm not familaiar with it either, but it looks from the documentation as if -removeObjecter:forKeyPath: should remove all observers, but -removeObjecter:forKeyPath:context: should only remove the observer which was added using the specified context (an opaque pointer). |
Since the context pointer is opaque I believe this is something that is left to the user to implement. I am going to do a bit more research on this. For now, I have made it so that the method throws an exception. |
The If you want to add this method you probably also want to add |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That looks plausible to me. If only we had testcases :-(
I will add some as a separate PR. I will develop them on macOS. |
Addresses issue #322.