0

I have this error while I was testing the code in Xcode 7 beta, the error between the two asterisk

class ViewController: UIViewController {

@IBOutlet weak var agee: UITextField!
@IBOutlet weak var labelAge: UILabel!
@IBAction func findAge(sender: AnyObject) {


    *var enteredAge = agee!.text.toInt()*

    if enteredAge != nil {

        var catYears = enteredAge! * 7

        labelAge.text = "Your cat is \(catYears) in cat years"

    } else {

        labelAge.text = "Please enter a number in the box"

    }


}
Khalid
  • 1

1 Answers1

-1
@IBOutlet var agee: UITextField!
@IBOutlet var labelAge: UILabel!
@IBAction func findAge(sender: AnyObject) {

    if agee != nil {

    var enteredAge = agee.text.toInt()
    var catYears = enteredAge! * 7

    labelAge.text = "Your cat age is \(catYears) in cat years"
    print(catYears) // Just check in the logs
    }
    else {
        labelAge.text = "Please enter a number in the box"
    }

}

Just paste the above code in your project.

Don't forget to connect those @IBOutlets and @IBAction again[ctrl+drag] in the assistant editor. Otherwise you'll stuck in a signal issue(SIGABRT) Hope it helps!

Suprem Vanam
  • 73
  • 11