I am new to Epoxy and I'm currently trying some use-cases to check if it's a good fit for my project. I understand that the data that are set to a Controller should be immutable.
In my case I have a View with several toggles and checkboxes and I want to keep track of the user's interactions, because based on those interactions I need to create my network request, later on. I have searched a lot in the documentation and sample projects of Epoxy but haven't found an example with the proper way to do such a thing.
What is the correct way for the user's interaction to change the data model that my controller has.
After a lot of searching, it turns out that you should copy (shallow not deep) the list past to the controller, and change the data (interacted by the user) to the new one, and the pass it again to the controller. I just put this answer here for anyone that stumbles upon this post
val newList = ArrayList(originalList.map { it.copy() })
newList.find { it.id == event.data.id }?.isMainToggleOn = !event.data.isMainToggleOn
controller.setData(newList)
originalList = newList