I have a String array:
values = [textField1.text!, textField2.text!, textField3.text!, textField4.text!, textField5.text!]
and I want to convert it to an Int array. How do i do it in swift 2.0?
You can use the Swift map function:
var intArray = values.map({Int($0) ?? 0})
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With