A scheduler for performing synchronous actions.


struct ImmediateScheduler


You can only use this scheduler for immediate actions. If you attempt to schedule actions after a specific date, this scheduler ignores the date and performs them immediately.


Declaring Scheduler Timekeeping and Options

struct ImmediateScheduler.SchedulerTimeType

The time type used by the immediate scheduler.

typealias ImmediateScheduler.SchedulerOptions

A type that defines options accepted by the immediate scheduler.

Accessing Scheduler Time Properties

var minimumTolerance: ImmediateScheduler.SchedulerTimeType.Stride

The minimum tolerance allowed by the immediate scheduler.

var now: ImmediateScheduler.SchedulerTimeType

The immediate scheduler’s definition of the current moment in time.

Using the Shared Scheduler

static let shared: ImmediateScheduler

The shared instance of the immediate scheduler.

Scheduling Actions

func schedule(() -> Void)

Performs the action at the next possible opportunity, without options.

func schedule(after: ImmediateScheduler.SchedulerTimeType, () -> Void)

Performs the action at some time after the specified date, using the scheduler’s minimum tolerance.

func schedule(after: ImmediateScheduler.SchedulerTimeType, interval: ImmediateScheduler.SchedulerTimeType.Stride, () -> Void) -> Cancellable

Performs the action at some time after the specified date, at the specified frequency, using minimum tolerance possible for this Scheduler.

func schedule(options: ImmediateScheduler.SchedulerOptions?, () -> Void)

Performs the action at the next possible opportunity.


Conforms To

See Also


protocol Scheduler

A protocol that defines when and how to execute a closure.

protocol SchedulerTimeIntervalConvertible

A protocol that provides a scheduler with an expression for relative time.