Scheduler

public struct Scheduler

Scheduler struct, based on top of DispatchSourceTimer.

  • Schedule timer.

    Declaration

    Swift

    public private(set) var timer: DispatchSourceTimer
  • Schedule deadline.

    Declaration

    Swift

    public private(set) var deadline: DispatchTime
  • Schedule repeating interval.

    Declaration

    Swift

    public private(set) var repeating: DispatchTimeInterval
  • Schedule quality of service.

    Declaration

    Swift

    public private(set) var qualityOfService: DispatchQoS
  • Schedule handler.

    Declaration

    Swift

    public private(set) var handler: (() -> Void)?
  • Create a schedule.

    Declaration

    Swift

    public init(deadline: DispatchTime, repeating: DispatchTimeInterval, qualityOfService: DispatchQoS = .default, handler: (() -> Void)? = nil)

    Parameters

    deadline

    Deadline.

    repeating

    Repeating interval

    qualityOfService

    Quality of service.

    handler

    Closure handler.

  • Set the handler after schedule creation.

    Declaration

    Swift

    public mutating func setHandler(_ handler: @escaping () -> Void)

    Parameters

    handler

    Closure handler.