0

I have been working at this for about an hour now. I've looked at other questions n this sight with the exact same error and I tried there solutions. I am still getting the error though. Here is my code:

class Links: UIViewController {

let firstLinkButton: UIButton?

let secondLinkButton: UIButton?


@IBAction func firstLinkButton(sender: AnyObject) {

    UIApplication.sharedApplication().openURL(NSURL(string: "http://www.google.com")!)

}

@IBAction func secondLinkButton(sender: AnyObject) {

    UIApplication.sharedApplication().openURL(NSURL(string: "http://www.bing.com")!)



}


override func viewDidLoad() {
    super.viewDidLoad()

    // Do any additional setup after loading the view.
}

override func didReceiveMemoryWarning() {
    super.didReceiveMemoryWarning()
    // Dispose of any resources that can be recreated.
}

}

This is probably the simplest question on this sight today but any input or suggestions are greatly appreciated. Thanks in advance.

P.S.: R.I.P. my reputation.

Bigfoot11
  • 911
  • 2
  • 11
  • 25

1 Answers1

4

Make the buttons var

var firstLinkButton: UIButton?

var secondLinkButton: UIButton?

let constants must be initialized instantly.

vadian
  • 274,689
  • 30
  • 353
  • 361