I understand how to use didSet
and willSet
for variables but not really why. When should I use these methods and why?
Usually when you update a value you have some kind of button for example where you update a textField
and then set a variables value to the textFields
for example. If I want to pass something to another viewController
or I do it in the button action.
So my question is:
When and why should I use didSet
and willSet
for my variables?