.toInt() removed in Swift 2?

In Swift 2.x, the .toInt() function was removed from String. In replacement, Int now has an initializer that accepts a String

Int(myString)

In your case, you could use Int(textField.text!) insted of textField.text!.toInt()

Swift 1.x

let myString: String = "256"
let myInt: Int? = myString.toInt()

Swift 2.x, 3.x

let myString: String = "256"
let myInt: Int? = Int(myString)

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)