Why are TextField and Label both considered IBOutlet? One seems to be input the other output.
I am trying to debug an NSUnknownKeyException when XCode simulator is is starting. I am running Steve Derico's TipCalculator exercise and neither my code nor his sample code has build errors but the both report the above error during simulation.
2014-12-29 22:42:32.108 TipCalculator[14401:2353607] *** Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[ setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key calculateTapped.'
import UIKit class ViewController: UIViewController {
@IBOutlet weak var billTextField: UITextField!
@IBOutlet weak var tipLabel: UILabel!
@IBOutlet weak var tipRateSegmentedControl: UISegmentedControl!
@IBAction func calculateTapped(sender: AnyObject) {
var userInput = billTextField.text as NSString
var totalBill: Float = userInput.floatValue
var index: Int = tipRateSegmentedControl.selectedSegmentIndex
var tipRate: Float = 0.10
...series of if's.. var tip: Float = totalBill * tipRate tipLabel.text = "$(tip)" } @TimLewis I edited to show the code