3 ms·
There's no direct equivalent to willSet or didSet. The closest equivalent (aside from adding code before/after your own get/set code) might be INotifyPropertyCh
by taspeotis 9y ago
There's no direct equivalent to willSet or didSet. The closest equivalent (aside from adding code before/after your own get/set code) might be INotifyPropertyChanged [1]/INotifyPropertyChanging [2]? But they are more for external observers and add a lot of boilerplate to your code. It's possible to manage the boilerplate, however [3].
[1] https://msdn.microsoft.com/en-us/library/system.componentmodel.inotifypropertychanged(v=vs.110).aspx#Examples https://msdn.microsoft.com/en-us/library/system.componentmod...
[2] https://msdn.microsoft.com/en-us/library/system.componentmodel.inotifypropertychanging(v=vs.110).aspx#Remarks https://msdn.microsoft.com/en-us/library/system.componentmod...
[3] https://github.com/Fody/PropertyChanged https://github.com/Fody/PropertyChanged