Type Method

scheduledTimer(timeInterval:invocation:repeats:)

Creates and returns a new NSTimer object and schedules it on the current run loop in the default mode.

Declaration

class func scheduledTimer(timeInterval ti: TimeInterval, invocation: NSInvocation, repeats yesOrNo: Bool) -> Timer

Parameters

ti

The number of seconds between firings of the timer. If ti is less than or equal to 0.0, this method chooses the nonnegative value of 0.1 milliseconds instead.

invocation

The invocation to use when the timer fires. The invocation object maintains a strong reference to its arguments until the timer is invalidated.

repeats

If true, the timer will repeatedly reschedule itself until invalidated. If false, the timer will be invalidated after it fires.

Return Value

A new NSTimer object, configured according to the specified parameters.

Discussion

After ti seconds have elapsed, the timer fires, invoking invocation.

See Also

Creating a Timer

class func scheduledTimer(timeInterval: TimeInterval, target: Any, selector: Selector, userInfo: Any?, repeats: Bool)

Creates and returns a new NSTimer object and schedules it on the current run loop in the default mode.

init(timeInterval: TimeInterval, invocation: NSInvocation, repeats: Bool)

Creates and returns a new NSTimer object initialized with the specified invocation object.

init(timeInterval: TimeInterval, target: Any, selector: Selector, userInfo: Any?, repeats: Bool)

Creates and returns a new NSTimer object initialized with the specified object and selector.

init(fireAt: Date, interval: TimeInterval, target: Any, selector: Selector, userInfo: Any?, repeats: Bool)

Initializes a new NSTimer object using the specified object and selector.