<!--
{
  "availability" : [
    "iOS: 2.0.0 -",
    "iPadOS: 2.0.0 -",
    "macCatalyst: 13.0.0 -",
    "macOS: 10.0.0 -",
    "tvOS: 9.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 2.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Foundation",
  "identifier" : "/documentation/Foundation/Timer/scheduledTimer(timeInterval:invocation:repeats:)",
  "metadataVersion" : "0.1.0",
  "role" : "Type Method",
  "symbol" : {
    "kind" : "Type Method",
    "modules" : [
      "Foundation"
    ],
    "preciseIdentifier" : "c:objc(cs)NSTimer(cm)scheduledTimerWithTimeInterval:invocation:repeats:"
  },
  "title" : "scheduledTimer(timeInterval:invocation:repeats:)"
}
-->

# scheduledTimer(timeInterval:invocation:repeats:)

Creates a new timer and schedules it on the current run loop in the default mode.

```
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.0001` seconds 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.

`yesOrNo`

If <doc://com.apple.documentation/documentation/Swift/true>, the timer will repeatedly reschedule itself until invalidated. If <doc://com.apple.documentation/documentation/Swift/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

  [Threading Programming Guide](https://developer.apple.com/library/archive/documentation/Cocoa/Conceptual/Multithreading/Introduction/Introduction.html#//apple_ref/doc/uid/10000057i)

  [Timer Programming Topics](https://developer.apple.com/library/archive/documentation/Cocoa/Conceptual/Timers/Timers.html#//apple_ref/doc/uid/10000061i)



---

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)