Timer

  • Creates and schedules a one-time NSTimer instance.

    @returns The newly-created NSTimer instance.

    Declaration

    Swift

    class func schedule(delay: TimeInterval, handler: @escaping (Timer?) -> Void) -> Timer

    Parameters

    delay

    The delay before execution.

    handler

    A closure to execute after delay.

  • Creates and schedules a repeating NSTimer instance.

    @returns The newly-created NSTimer instance.

    Declaration

    Swift

    class func schedule(repeatInterval interval: TimeInterval, handler: @escaping (Timer?) -> Void) -> Timer

    Parameters

    repeatInterval

    The interval between each execution of handler. Note that individual calls may be delayed; subsequent calls to handler will be based on the time the NSTimer was created.

    handler

    A closure to execute after delay.