A Superclass :
class MySuperView : UIView{
var aProperty ;
}
A subclass inheritance the super class :
class Subclass : MySuperClass{
// I want to override the aProperty's setter/getter method
}
I want to override the superclass's property's setter/getter method ,
how to override this method in Swift ? Please help me , thanks .
Best Answer
What do you want to do with your custom setter? If you want the class to do something before/after the value is set, you can use
willSet
/didSet
:If, however, you want to completely change how the setter interacts with the superclass: