This is my first Swift experience. I am following an example in the book Swift by Example, and apparently there is a typo as I copied the code from the author's github [site](https://github.com/gscalzo/GuessTheNumber).

Here's the relevant code that seems to be causing the problem. I am getting this error:

> 
> Value of optional type String? not unwrapped
> 
> 
> 

in this line: let number = numberTxtField.text.toInt() .

```
 @IBOutlet weak var numberTxtField: UITextField!

   @IBAction func onOkPressed(sender: AnyObject) {
        let number = numberTxtField.text.toInt()
        if let number = number {
            selectedNumber(number)
        } else {
            var alert = UIAlertController(title: nil, message: "Enter a number", preferredStyle: UIAlertControllerStyle.Alert)
            alert.addAction(UIAlertAction(title: "OK", style: UIAlertActionStyle.Default, handler: nil))
            self.presentViewController(alert, animated: true, completion: nil)
        }
    }

```

Could someone kindly explain how to fix this as this is Day One for me with Swift and I'm still trying to digest symbols like ! and ? and ??

I've read other questions like this one but they didn't seem to help me resolve this issue.

Thanks