Reputation: 271684
class Base: UIViewController {
var rightButtonColor: UIColor = UIColor.blueColor()
}
class SecondViewController: Base {
override var rightButtonColor: UIColor {
return UIColor.redColor()
}
}
I'm getting an error:
Getter for 'rightButtonColor' with Objective-C selector 'rightButtonColor' conflicts with getter for 'rightButtonColor' from superclass 'Base' with the same Objective-C selector
Upvotes: 5
Views: 5173
Reputation: 3130
The two different declarations of rightButtonColor
have different types. It compiles cleanly if you make sure they're the exact same type:
class Base: UIViewController {
var rightButtonColor: UIColor {
return UIColor.blueColor()
}
}
class SecondViewController: Base {
override var rightButtonColor: UIColor {
return UIColor.redColor()
}
}
Upvotes: -2
Reputation: 1010
Try like this:
class Base: UIViewController {
var rightButtonColor: UIColor {
return UIColor.blueColor()
}
}
class SecondViewController: Base {
override var rightButtonColor: UIColor {
return UIColor.redColor()
}
}
Upvotes: 7