<!--
{
  "availability" : [
    "iOS: 18.0.0 -",
    "iPadOS: 18.0.0 -",
    "macCatalyst: 18.0.0 -",
    "macOS: 15.0.0 -",
    "tvOS: 18.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 11.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Foundation",
  "identifier" : "/documentation/Foundation/DiscreteFormatStyle/input(before:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Foundation"
    ],
    "preciseIdentifier" : "s:10Foundation19DiscreteFormatStyleP5input6before0C5InputQzSgAG_tF"
  },
  "title" : "input(before:)"
}
-->

# input(before:)

The next input value before the given input.

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

## Return Value

The next “smalller” input value that can be represented by
[`FormatInput`](/documentation/Foundation/FormatStyle/FormatInput) or an underlying representation the format style uses
internally.

## Discussion

Use this function to determine if the return value provided by [`discreteInput(after:)`](/documentation/Foundation/DiscreteFormatStyle/discreteInput(after:)) is
precise enough for your use case for any input `y`:

```swift
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(_:)`](/documentation/Foundation/FormatStyle/format(_:)) at a higher rate in that interval, as there is
no guarantee for what the output will be in that interval.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)