---
title: "acceptInput(forMode:before:)"
framework: foundation
role: symbol
role_heading: Instance Method
path: "foundation/runloop/acceptinput(formode:before:)"
---

# acceptInput(forMode:before:)

Runs the loop once or until the specified date, accepting input only for the specified mode.

## Declaration

```swift
func acceptInput(forMode mode: RunLoop.Mode, before limitDate: Date)
```

## Parameters

- `mode`: The mode in which to run. You may specify custom modes or use one of the modes listed in Run Loop Modes.
- `limitDate`: The date up until which to run.

## Discussion

Discussion If no input sources or timers are attached to the run loop, this method exits immediately; otherwise, it runs the run loop once, returning as soon as one input source processes a message or the specifed time elapses. note: A timer is not considered an input source and may fire multiple times while waiting for this method to return Manually removing all known input sources and timers from the run loop is not a guarantee that the run loop will exit. macOS can install and remove additional input sources as needed to process requests targeted at the receiver’s thread. Those sources could therefore prevent the run loop from exiting.

## See Also

### Running a Loop

- [run()](foundation/runloop/run().md)
- [run(mode:before:)](foundation/runloop/run(mode:before:).md)
- [run(until:)](foundation/runloop/run(until:).md)
