I am new to the MVVM pattern, and not sure how to handle communication between view models. There is a table view that contains multiple cell views. I created view models for the table and each cell:
TableView - TableViewModel
InputCellView - InputCellViewModel
CheckboxCellView - CheckboxCellViewModel
.....
The cells contains user input elements like text fields, checkboxes and so on. Each CellViewModel holds the data that was input by the user in the corresponding cell. My question is, what is the best way to transfer that data to the TableViewModel? I am currently thinking of passing a reference of TableViewModel the every CellViewModel and whenever the user changes some data in a cell, the CellViewModel will forward it to the TableViewModel. Is this a valid aproach with the MVVM pattern? Or is it better to user some kind of event system to notify the TableViewModel about changes in a CellViewModel?