-
Notifications
You must be signed in to change notification settings - Fork 359
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
Potential KVO bindings issue #21
Comments
Thanks for the feedback Ian. Yeah, this'll need some improvement. In addition to your suggestion, I'm thinking to allow option to retain observed NSObject by the Dynamic. Do you think that that might help in some situations? |
I think it would be more dangerous to retain observed NSObject by the Dynamic than to ask user to stop observing directly. |
Ok, I can see the problem. Please have in mind that Cocoa Touch does not officially support KVO on UIKit objects. It's just a coincidence it works. In your case, better approach would be to register your view controller as a delegate of your table view and implement method UITableView is a subclass of UIScrollView and UITableViewDelegate inherits UIScrollViewDelegate so you can get offset change that way. |
Hm. Just made infinite scroll using Bond and KVO observing. It seems to be no issue if make the bond (contentOffset listener) equals to nil in right place. |
I am currently in the same situation. I have couple KVO observers, then values mapped to viewModel and those dynamics bound to UIViews. This all is wrapped in DynamicArray which when cleared (removeAll) causes crash
How to fix this? :O |
I'm not sure and didn't test yet, but it seems to be an issue, that removeObserver is called only from deinit of KVO Helper. It may be a situation, when observable NSObject can be deallocated before Dynamic object who observers an KVO object. In this case an app will crash on iOS 8.
So I suggest to give an option for user so that he could call removeObserver when it is really necessary.
The text was updated successfully, but these errors were encountered: