-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
Dealing with table updates #996
Comments
Why not wrap several table updates into some kind of batch? And when some view model signal sends next (a batch), call I'd love to hear some best practices in managing table/collection views too. |
I'm in the process of crafting TableViewModel right now. Here is the implementation of change object. This objects are sent by change signal of view model. You need to create category on UITableView and implement QWSectionedList protocol. Then simply send applyToList:tableView. |
Here is a protocol (WIP) for table view model |
@denis-mikhaylov Interesting strategy. I like the concept. Thanks! Curious if others have thoughts on this too. |
@denis-mikhaylov When you wrap that up, it would be awesome if you put together a quick sample app showing it off. Good learning tool. |
@sprynmr sure I will! |
@sprynmr Have a look at #1032. |
@denis-mikhaylov Back to this again. Looking at your list which is pretty cool. Curious if you made updates? |
@sprynmr Well. After the introduction of #1032 it became as trivial as observing collection of collections and animating corresponding changes. So I decided not to waste time on sectioned list. |
Makes sense. I'm just not using 3.0 yet. |
Me neither. Just implemented this using rac_valuesAndChanges:forKeypath:options:observer: |
I'm trying to think if there's a more RAC way to deal with table updates.
Basically I have a table that has 4 or 5 distinct states. As a user goes through building a question, they trigger a state update by doing something like clicking a button to advance, or clicking a pseudo back button to move back.
Now all the cells can observe the state on the viewModel and update themselves accordingly. Where it gets hair is all the rows/sections that are inserted/removed/reloaded (to update height).
If I didn't need to run
beginUpdates
andendUpdates
with all the respective table changes in between, it would be pretty easy to filter and map the changes into some nice clean code, but those begin and end calls really throw a wrench in the the works.So I end up with code like this:
I thought about having a
beginUpdatesSubject
thatmapReplace
s into the view state signal and splitting lots of signals off of that, but then I have to also somehow observe for all those other signals to complete to callendUpdates
. In the end it didn't end up looking much better than a nested if.Thoughts?
The text was updated successfully, but these errors were encountered: