I am using MVVM pattern with RxSwift, RxCocoa, RxDataSources.
I have successfully populated the UITableView
with array of PaletteViewModel
present in ListViewModel
by using RxDataSource
but it's one way binding.
I want to achieve what I have shown in the picture i.e. I want to bind the UITextField
from UITableViewCell
to the Observable
which is present at some index in the array in ListViewModel
I want to do 2 way binding
with the UITextField
and answer
property of the PaletteViewModel
. If the user changes the text in the textField it should change the value in the answer property present at particular index and vice versa.
How Can I achieve something complex like this using MVVM pattern
using ReactiveX
frameworks?
What if the UITableViewCell
at some IndexPath
is removed from the memory as it's not visible and the observable's value is changed will it result in crash as the UITextField
at that IndexPath
will return nil?