Check out example codes for "convert string to int swift". It will help you in understanding the concepts better.

Code Example 1

let myString1 = "10"
let myInt1 = Int(myString1) ?? 0
// you need to provide the optional in case the string can't be converted

Learn ReactJs, React Native from akashmittal.com