I'm currently studying design patterns in Swift, particularly in Command pattern, design to encapsulate details of how to invoke a method on an object in a way that allows the method to be invoked at a different time or by different component.
I'm stuck in a situation wherein my undo function is now behaving as expected. Here is the link to my project: http://ift.tt/2bvnKZ6
Expected output:
Total: 38
Undo called. Total: 40
Undo called. Total: 10
Undo called. Total: 0
However, may result is:
Total: 38
Undo called. Total: 36
Undo called. Total: 144
Undo called. Total: 154
Could you possibly help to determine if I missed something? Many thanks!
Aucun commentaire:
Enregistrer un commentaire