4 ms·
Swift has the same syntax too except the last line. Have they introducted willSet and didSet too? Neat stuff, i may try the language out in a future project o
by DelightOne 9y ago
Swift has the same syntax too except the last line.
Have they introducted willSet and didSet too?
Neat stuff, i may try the language out in a future project on windows.
- taspeotis 9y agoThere'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