So far we've seen how to store values in properties and calculate them dynamically with computed properties. But what if you want to react every time a property changes β€” automatically, without having to remember to call a function yourself? That's exactly what property observers are for. πŸ₯

Swift gives us two flavors:

didSet β€” runs after the property changes

willSet β€” runs before the property changes

The Problem Without Property Observers