The minimum number of digits after the decimal separator.
SDKs
- iOS 2.0+
- macOS 10.4+
- Mac Catalyst 13.0+
- tvOS 9.0+
- watchOS 2.0+
Framework
- Foundation
Declaration
@property NSUInteger minimumFractionDigits;
Discussion
By default, this property is set to 0
.
The following code demonstrates the effect of setting minimum
when formatting a number:
var numberFormatter = NumberFormatter()
numberFormatter.minimumFractionDigits = 0 // default
numberFormatter.string(from: 123.456) // 123
numberFormatter.minimumFractionDigits = 5
numberFormatter.string(from: 123.456) // 123.45600