I have textfield and i need to put inside session value and when i add gives me
fatal error: unexpectedly found nil while unwrapping an Optional value
error
My codes here
@IBOutlet weak var discountField:UITextField!
func textFieldDidEndEditing(textField: MPGTextField_Swift, withSelection data: Dictionary<String,AnyObject>){
let displayDiscount : AnyObject? = data["discount"]
let addClientDiscount:String = (displayDiscount as? String)!
prefs.setObject(addClientDiscount, forKey: "addClientDiscount")
self.discountField.text = "\(addClientDiscount)" // THIS LINE GIVES ERROR
}
Also PROPERTLY Have ! in referencing Outlets
Thanks
discountField
toxib
orstoryboard
properly? – BreekIB
anddiscountField
. Btw, do you have multipletextField
? – Breek