I am trying to reduce the amount of characters in a double. How Would I reduce this:
59.5220000
to
59.5
this in swift?
A double doesn't have characters. A string rendering of it does. Rather than using the standard String() initializer (which is really only for development use, it's terrible for end-users), use NumberFormatter.
perhaps use a formatted string?
let str = String(format: "%.2f", 59.5220000)
String(format:_:) is not localized. NumberFormatter is much better solution for displaying results in the UI...
NSNumber, but NSNumbers are easily initialized from Doubles