Convert Int to String in Swift
Asked 07 September, 2021
Viewed 436 times
  • 63
Votes

I'm trying to work out how to cast an Int into a String in Swift.

I figure out a workaround, using NSNumber but I'd love to figure out how to do it all in Swift.

let x : Int = 45
let xNSNumber = x as NSNumber
let xString : String = xNSNumber.stringValue

23 Answer