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
I'd say if it isn't broke don't fix it. I can thing of one other way, but it's not any shorter or anything:
var number = 123 var digits = map(String(number)) { String($0).toInt() ?? 0 }