mercredi 20 juillet 2016

didSet detection on ANY field?

I've done some searching (and mostly finished C# in depth) but haven't come across what I'm looking for.

I'm curious though if there is a way (hacky is ok!) that I can get a generic notification or hook from ANY set operation on a class.

The reason is I am working on a framework that saves the state of the app as a class. And when the state changes, I want a notification from it.

Setting up a didSet (i.e. firing an alert in every setter call) on every possible field is tedious overkill. Do you know of any way I can get hook for any time a field is changed on a class?





Aucun commentaire:

Enregistrer un commentaire