Open n13 opened 5 years ago
Have same issue, due to that my viewmodel does not get released. and memory increasing. please suggest a way
@manishkkatoch For what it's worth, I had to fix this issue for our app. The changes I made are pretty significant -- the bulk of them are here https://github.com/ridewithgps/SimpleTwoWayBindingIOS/commit/52650c2df81bba8907af04c36f6b2c72d2180e65 -- but I could spend some time working on a smaller PR to push the changes back here, if you'd like.
If you'd like to take this discussion off GitHub, please email me at ryan@ridewithgps.com
An unbind method requested in https://github.com/manishkkatoch/SimpleTwoWayBindingIOS/issues/4 might solve this.
I noticed that there's no support for removing an observer, and observers are held in an array.
That means that over time, as more and more views are used, the array of observers fills up with more and more items - hopefully the blocks used did not reference anything big, using weak self and so on should keep it small.
Still, I need to be able to remove observers.
Then observers could be added / removed when views willShow / willHide