I have two errors here. I'm trying to get a UIAlertView that comes up when the button is pressed. From there, I want the user to input a new number (Double) and then have it update the variable timeWorkedGoal as well as the timeWorkedGoalNumber label.
I'm getting the error "Use of unresolved identifier 'UIKeyboardTypeNumberPad'" as well as the error "Reference to property 'timeWorkedGoalNumber' in closure requires explicit 'self'. to make capture semantics explicit." Does anybody know how my syntax is off? Thanks!
var timeWorkedGoal = 1.1 @IBOutlet weak var timeWorkedGoalNumber: UILabel! @IBAction func resetTimeWorkedGoalButton(sender: AnyObject) { var timeWorkedAlert = UIAlertController(title: "Time Worked", message: "Your current work time goal is \(timeWorkedGoal) hours – Enter your new goal.", preferredStyle: UIAlertControllerStyle.Alert) timeWorkedAlert.addTextFieldWithConfigurationHandler { (textField) in } timeWorkedAlert.addAction(UIAlertAction(title: "Submit", style: .Default, handler: { (action) in let textF = timeWorkedAlert.textFields![0] as UITextField print(textF) textF.keyboardType = UIKeyboardTypeNumberPad; timeWorkedGoal = (Double("\(textF)"))! print(timeWorkedGoal) timeWorkedGoalNumber.text = "\(textF)" })) timeWorkedAlert.addAction(UIAlertAction(title: "Cancel", style: .Default, handler: { (action) in self.dismissViewControllerAnimated(true, completion: nil) })) self.presentViewController(timeWorkedAlert, animated: true, completion: nil) }