Contents

input(before:)

The next input value before the given input.

Declaration

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

Return Value

The next “smalller” input value that can be represented by FormatInput or an underlying representation the format style uses internally.

Discussion

Use this function to determine if the return value provided by discreteInput(after:) is precise enough for your use case for any input y:

guard let x = style.discreteInput(after: y) else {
    return
}

let z = style.input(before: x) ?? y

If the distance between z and x is too large for the precision you require, you may want to manually probe format(_:) at a higher rate in that interval, as there is no guarantee for what the output will be in that interval.