<!--
{
  "availability" : [
    "iOS: -",
    "iPadOS: -",
    "macCatalyst: -",
    "macOS: -",
    "swift: -",
    "tvOS: -",
    "visionOS: -",
    "watchOS: -"
  ],
  "documentType" : "symbol",
  "framework" : "Dispatch",
  "identifier" : "/documentation/Dispatch/DispatchSourceTimer/scheduleOneshot(wallDeadline:leeway:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Dispatch"
    ],
    "preciseIdentifier" : "s:So24OS_dispatch_source_timerP8DispatchE15scheduleOneshot12wallDeadline6leewayyAC0E8WallTimeV_AC0eL8IntervalOtF"
  },
  "title" : "scheduleOneshot(wallDeadline:leeway:)"
}
-->

# scheduleOneshot(wallDeadline:leeway:)

Schedules a timer to fire once with the specified deadline and leeway values.

```
func scheduleOneshot(wallDeadline: DispatchWallTime, leeway: DispatchTimeInterval = .nanoseconds(0))
```

## Parameters

`wallDeadline`

The time at which to execute the dispatch source’s event handler.

`leeway`

The maximum amount of time after deadline by which the system may delay the delivery of the timer event.

## Discussion

The system may defer the deliver of timer events to improve power consumption and system performance. The first time the timer fires, the maximum allowable delay is equal to the value in the `leeway` parameter.

The system may fire a timer sooner than the value in the `deadline` parameter. If you created the timer with the [`strict`](/documentation/Dispatch/DispatchSource/TimerFlags/strict) flag, the system makes every effort to observe the provided `leeway` value, even if it is smaller than the current lower limit.

Calling this method on a cancelled dispatch source has no effect.

---

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)