Hey Łukasz. That’s a great question. You don’t realize this issue unless you try building something more complex than a countdown app. :) I didn’t cover this issue in this article not to complicate things so I am glad you asked.
I’ve used an array to log what has been changed before committing a new state in my sample app. You basically create an enum to identify each property in your state struct and populate changelog array with the IDs of properties that are changed. I don’t think this is an ideal solution but it’s the best I have so far. You can check the actual implementation here. It’s also worth mentioning that Swift 4 has potential to simplify this process using key-paths but I don’t have a working sample yet.
I also use a similar strategy while passing messages between view model and view controller. You can also check my other article on MVVM+Redux if you’re interested.
