I can't seem to find a way to format a Double limiting the precision to just a couple of positions after the decimal point when presenting that in a label. Maybe I'm missing something major, but I couldn't find anything in the official documentation.
Thanks in advance for the help!
NSNumberFormatter
, which honors the device'slocale
. Thuslet formatter = NSNumberFormatter()
, setminimumFractionDigits
andmaximumFractionDigits
to however many digits you want, and then you can dolet string = formatter.stringFromNumber(3.1415)
. – Shroud