I have a quick class in which I am trying to pass the default value for a function parameter:
class SuperDuperCoolClass : UIViewController {
let primaryColor : UIColor = UIColor(red: 72.0/255.0, green: 86.0/255.0, blue: 114.0/255.0, alpha: 1.0)
func configureCheckmarkedBullet(bullet: UIButton, color: UIColor = primaryColor){
}
}
As stated above, if I try to use a constant as the default value for a function parameter, the compiler complains with the error below:
SuperDuperCoolClass.Type does not have a member named 'primaryColor'
but if I directly assign the RHS value in this way, he will not complain: - /:
func configureCheckmarkedBullet(bullet: UIButton, color: UIColor = UIColor(red: 72.0/255.0, green: 86.0/255.0, blue: 114.0/255.0, alpha: 1.0)) {
}
Any ideas on how to silence the above compilation error?
source
share