If I have the integer 123 and I want to break the digits into an array [1,2,3] what is the best way of doing this? I have messed around with this a lot and I have the follo
My take for Swift 2:
var x = 123 var digits = String(x).characters.map { Int(String($0))! } // [1,2,3]
It is more explicit about the characters, so I think it is quite readable.