When I get the value from a Text Field and cast it to an integer, I get log output that says Optional(5)
if I inputted 5, or Optional(1234)
if I inputted 1234.
What does Optional()
mean?
Here is the code to get and cast the value:
@IBOutlet weak var myInput: UITextField!
// When a button is clicked, I log the value in the UI text field.
@IBAction func someButton(sender: AnyObject) {
println(self.myInput.text.toInt())
}