When tableView.dataSource = reloadableViewLayoutAdapter which takes a array of Layout items ( a subclass of InsetLayout), how do I get selected model data from the below table view delegate? do I need to hold on to model reference inside my layout class?
class MyReloadableViewLayoutAdapter: ReloadableViewLayoutAdapter {
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
let item = currentArrangement[indexPath.section].items[indexPath.item]
print("items: \(item)")
}
}
I'd keep a separate data structure of view models or domain models and handle the user interactions at that level. The Layout items I'd use just for producing a UI representation of the current state.
When), how do I get selected model data from the below table view delegate? do I need to hold on to model reference inside my layout class?
tableView.dataSource = reloadableViewLayoutAdapter
which takes a array of Layout items ( a subclass of InsetLayout