Restricting property updates with the Vetoable delegate

In this recipe, we are going to explore the usage of the Vetoable delegate offered by the standard library. Similar to the Observable, the Vetoable tracks the changes applied to the delegated property. However, the Vetoable delegate is able to refuse to update the delegated property if a predefined update condition is not met. We are going to declare a variable of the Int type and specify the update condition, allowing us to update the variable only if the absolute value of change is greater than or equal to 10.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.136.25.146