Contents

discreteInput(before:)

The next discretization boundary before the given input.

Declaration

func discreteInput(before input: Self.FormatInput) -> Self.FormatInput?

Return Value

For most inputs, the method returns the “greatest” value “smaller” than input for which the style produces a different FormatOutput, or nil if no such value exists. For some input values, the function may also return a value “smaller” than input for which the style still produces the same FormatOutput as for input.

Discussion

Use this function to determine the next “smaller” input that warrants updating the formatted output. The following example prints all possible outputs the format style can produce downwards starting from the startInput:

var previousInput = startInput
while let nextInput = style.discreteInput(before: previousInput) {
    print(style.format(nextInput))
    previousInput = nextInput
}