I am trying to create a UIButton by trying to initialise in a viewController as shown below. However, I am getting cannot convert value of type () -> _ to specified type UIButton error which I don't have idea how I stuck into.
let loginRegisterButton : UIButton = {
let button = UIButton(type: .System)
button.backgroundColor = UIColor(r: 80, g: 101, b: 161)
button.setTitle("Register", forState: .Normal)
button.translatesAutoresizingMaskIntoConstraints = false
return button
}
This is the sample code and I have used a UIColor extension and I have attached the screenshot of error herewith.
As far as I know, this is not a syntax error, but I have no idea what I am missing.
