Returns a precision that constrains formatted values to a given number of allowed digits in the integer part.
- Parameter length: The number of digits to use when formatting the integer part of a number.
- Returns: A precision that constrains formatted values to a given number of allowed digits in the integer part.
Returns a precision that constrains formatted values to a given number of allowed digits in the fraction part.
- Parameter length: The number of digits to use when formatting the fraction part of a number.
- Returns: A precision that constrains formatted values to a given number of allowed digits in the fraction part.
static func fractionLength<R>(_ limits: R) -> NumberFormatStyleConfiguration.Precision where R : RangeExpression, R.Bound == Int
Returns a precision that constrains formatted values to a range of allowed digits in the fraction part.
- Parameter limits: A range from the minimum to the maximum number of digits to use when formatting the fraction part of a number.
- Returns: A precision that constrains formatted values to a range of allowed digits in the fraction part.
Returns a precision that constrains formatted values to a given number of significant digits.
When using this precision, the formatter rounds values that have more significant digits than the maximum of the range, as seen in the following example:
```swift
let myNum = 123456.formatted(.number
.precision(.significantDigits(4))
.rounded(rule: .down)) // "123,400"
```
- Parameter digits: The maximum number of significant digits to use when formatting values.
- Returns: A precision that constrains formatted values to a given number of significant digits.
static func significantDigits<R>(_ limits: R) -> NumberFormatStyleConfiguration.Precision where R : RangeExpression, R.Bound == Int
Returns a precision that constrains formatted values to a range of significant digits.
When using this precision, the formatter rounds values that have more significant digits than the maximum of the range, as seen in the following example:
```swift
let myNum = 123456.formatted(.number
.precision(.significantDigits(2...4))
.rounded(rule: .down)) // "123,400"
```
- Parameter limits: A range from the minimum to the maximum number of significant digits to use when formatting values.
- Returns: A precision that constrains formatted values to a range of significant digits.
Returns a precision that constrains formatted values a given number of allowed digits in the integer and fraction parts.
When using this precision, the formatter pads values with fewer digits than the specified digits for the integer or fraction parts. Similarly, it rounds values that have more digits than specified. The following example shows this behavior, padding the integer part while rounding the fraction:
```swift
let myNum = 12345.6789.formatted(.number
.precision(.integerAndFractionLength(integer: 6,
fraction: 3))
.rounded(rule: .down)) // "012,345.678"
```
- Parameters:
- integer: The number of digits to use when formatting the integer part of a number.
- fraction: The number of digits to use when formatting the fraction part of a number.
- Returns: A precision that constrains formatted values a given number of digits in the integer and fraction parts.
Returns a precision that constrains formatted values to ranges of allowed digits in the integer and fraction parts.
When using this precision, the formatter rounds values that have more digits than the maximum of the range, as seen in the following example:
```swift
let myNum = 12345.6789.formatted(.number
.precision(.integerAndFractionLength(integerLimits: 2...,
fractionLimits: 2...3))
.rounded(rule: .down)) // "12,345.678"
```
- Parameters:
- integerLimits: A range from the minimum to the maximum number of digits to use when formatting the integer part of a number.
- fractionLimits: A range from the minimum to the maximum number of digits to use when formatting the fraction part of a number.
- Returns: A precision that constrains formatted values to ranges of digits in the integer and fraction parts.
Skipped declarations
1 declarations were excluded from these bindings. Each reason comes from the generator or the iOS SDK compiler.