Is this a bug when using maximumFractionDigits
and maximumSignificantDigits
together on NSNumberForamtter
on iOS 8?
NS
It isn't a bug. From the docs:
Note
When a number formatter is configured to use significant digits, it ignores any minimum or maximum values used to set integer or fraction digits.
https://developer.apple.com/documentation/foundation/nsnumberformatter/1417793-usessignificantdigits?language=objc
Note: If either maximumSignificantDigits
or minimumSignificantDigits
is set to any value, then usesSignificantDigits
is automatically set to true. This contradicts the docs for maximumSignificantDigits
and minimumSignificantDigits
which says:
You must set the usesSignificantDigits property to true in order for this property to affect formatting behavior.
You don't need to set usesSignificantDigits
to true, it will set itself to true.