1

during working on application hardly relying on RxSwift I encountered some(I'd to think) basic problem. I'm using RxDataSources sublibrary to manage section and items in my TableView. Everywhere I see a examples, how to achieve one way binging(I have a model, then I bind it to the TableView to show it), but I need also second way of binding - I need to modify my model during interacting with cell and refresh cell after that. I want to achieve that though using of observables during building a SectionModel, but I don't have a any idea, how can I achieve that. Maybe some encountered similar problem and now have some solution for that?

MiXen
  • 105
  • 1
  • 2
  • 12
  • What kind of interaction are you doing exactly within cells and what do you mean by "refresh cell after that"? – juliancadi Jul 13 '18 at 06:13
  • I have a quantity value of some property and buttons to modify that value(add/remove), so after I click some of the button, I change appropriate value in my model and then, I hope, that my model will notify observable, that he changed and force to refresh data in my table view. – MiXen Jul 14 '18 at 20:03

1 Answers1

0

Please have a look at .switchLatest() operator first, it may be sufficient for your purpose. It boils down to having an observable of observables, so you can easily switch from one to another while keeping the binding alive. If not, perhaps this framework will help - https://github.com/maxvol/RaspSwift

Maxim Volgin
  • 3,957
  • 1
  • 23
  • 38