9oya / GitHubSearch-reactorkit-demo

2 stars 0 forks source link

How to update the data of controller's reactor when change the cell reactor data? #11

Open mozartee opened 1 year ago

mozartee commented 1 year ago

Hi, thanks for your repo, but I have no idea about how to sync the data of controller and cell. e.g.: I have a button in the cell, and touch it to toggle the selected state, but how to update the controller's reactor's data? Thanks for help again! :)

9oya commented 1 year ago

If the button in the cell to which you are referring is the bookmark button located in 'UserListTbCell', then the reactor state in the view controller remains unchanged. only the data in local storage (Core Data) is updated.

The cell is keep filtering state of the button when it's appeared.

mozartee commented 1 year ago

Thanks for help, and I saw your code for resolve this problem, it's great! But the question is that I didn't used the 'Core Data', even no local storage scheme, it's just a simple vc with tableView.

9oya commented 1 year ago

You can save the states of the buttons in cells within the reactor. e.g. var buttonSelectionDict: [IndexPath:Bool] = [:] then you may give that bool value to cell's reactor when it's created.