input(before:)
The next input value before the given input.
Declaration
func input(before input: Range<Date>) -> Range<Date>?Return Value
If isPositive is true, the range input.lowerBound..<x, where x is the next smaller date that this style can differentiate, or nil if there is no such x greater or equal to input.lowerBound. If isPositive is false, the range x..<input.upperBound, where x is the next smaller date this style can differentiate.
Discussion
If isPositive is true, the next input value maintains the same lowerBound as input, but has a differentupperBound. If isPositive is false, the next input value maintains the same upperBound as input, but as a different lowerBound.
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) ?? yIf the distance between the upperBounds of 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.