XCODE BETA 7.4
So i am trying to make a tip calculator and i have 4 view controllers, one segue'd to the next all the way to the end. Iv written all of my code, and it would always crash when i press the last button which "calculates" the tip. So i rewrote my code and now im running it 3/4 of the way thru and it still crashes at the last button. here are my errors.
THE CONSOLE SAYS:
unexpectedly found nil while unwrapping an Optional value
(lldb)
and where it shows CPU, MEMORY, DISK, NETWORK, under that on THREAD 1 this is highlighted.
-> 0x30dd54 <+72>: trap <- Thread 1 : EXC_BREAKPOINT (code=EXC_ARM_BREAKPOINT, subcode=0xe7ffdefe)
and, heres my code.
import UIKit
class ViewController: UIViewController {
@IBOutlet var enteredAmount: UITextField!
@IBOutlet var enteredUsers: UITextField!
@IBOutlet var enteredTip: UITextField!
@IBOutlet var enteredAmountLabel: UILabel!
@IBOutlet var tipLabel: UILabel!
@IBOutlet var finalAmountLabel: UILabel!
@IBOutlet var tabPerPerson: UILabel!
@IBAction func clickForTotal(sender: AnyObject) {
let unwrappedAmountLabel = Int(enteredAmount.text!) ?? 0
let unwrappedTipLabel = Int(enteredTip.text!) ?? 0
let unwrappedUsers = Int(enteredUsers.text!) ?? 0
enteredAmountLabel.text = "\(unwrappedAmountLabel)"
tipLabel.text = "\(unwrappedTipLabel)"
tabPerPerson.text = "\(unwrappedUsers)"
}
override func viewDidLoad() {
super.viewDidLoad()
/
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
/
}
}