How To Convert An Int To String In Swift

Converting an Int to String in Swift is easy.

There are two ways of doing it:

String Constructor

let myInt: Int = 10
var myString = String(myInt)

String Interpolation

let myInt: Int = 10
var myString = "\(myInt)"

Convert Int To String

let myString: String = "10"
let myInt: Int = Int(myString)
If you liked this post and want to learn more, check out The Complete iOS Developer Bootcamp. Speed up your learning curve - hundreds of students have already joined. Thanks for reading!

Eddy Chung

I teach iOS development on ZeroToAppStore.com.

Similar Posts