Reputation: 9376
This should be super straightforward. Here's what I am trying to do:
class ViewController: UIViewController{
var leftBarButton: UIButton;
var rightBarButton: UIButton;
override func viewDidLoad() {
super.viewDidLoad()
}
}
But I am getting an error that viewController has no initializers. I know I need to give the variables default values, so I tried:
var rightBarButton: UIButton(type: UIButtonType.System) as UIButton;
But that's giving me an error about multiple declarations.
Upvotes: 0
Views: 83
Reputation: 4513
You need something like this
var rightBarButton: UIButton = UIButton(type: UIButtonType.System)
You need to intialize the button, but if you're not planning to change it I suggest you change it to let
Upvotes: 1