Byte 5 – Transformations

Working closer with MVVM, I got to the point where I got to use Transformations.

What this basically does is:

Whenever the phoneNumber variable changed, the function from the is triggered and isPhoneNumberValid changes.

Basically if isPhoneNumberValid is observed (and only if it’s observed), it will change to true or false based on the isPhoneNumberValid function without requiring any other extra steps.

This is particulary usefull in cases where the phoneNumber might be changed from multipel sources like:

  • user input
  • local data source getting queried
  • remote dat source getting downloaded
  • any other function that would maybe format the phone number.

More info about it here.

Leave a Comment


Recent posts