<!--
{
  "availability" : [
    "iOS: -",
    "iPadOS: -",
    "macCatalyst: -",
    "macOS: -",
    "tvOS: -",
    "visionOS: -",
    "watchOS: -"
  ],
  "documentType" : "symbol",
  "framework" : "Dispatch",
  "identifier" : "/documentation/Dispatch/DispatchSource/makeTimerSource(flags:queue:)",
  "metadataVersion" : "0.1.0",
  "role" : "Type Method",
  "symbol" : {
    "kind" : "Type Method",
    "modules" : [
      "Dispatch"
    ],
    "preciseIdentifier" : "s:So18OS_dispatch_sourceC8DispatchE15makeTimerSource5flags5queueSo0a1_b1_C6_timer_pAbCE0F5FlagsV_So0a1_b1_I0CSgtFZ"
  },
  "title" : "makeTimerSource(flags:queue:)"
}
-->

# makeTimerSource(flags:queue:)

Creates a new dispatch source object for monitoring timer events.

```
class func makeTimerSource(flags: DispatchSource.TimerFlags = [], queue: DispatchQueue? = nil) -> any DispatchSourceTimer
```

## Parameters

`flags`

Additional flags indicating the behavior of the timer. For a list of possible values, see [`DispatchSource.TimerFlags`](/documentation/Dispatch/DispatchSource/TimerFlags).

`queue`

The dispatch queue to which to execute the installed handlers.

## Return Value

A dispatch source object that conforms to the [`DispatchSourceTimer`](/documentation/Dispatch/DispatchSourceTimer) protocol.

## Discussion

After creating the dispatch source, use the methods of the [`DispatchSourceProtocol`](/documentation/Dispatch/DispatchSourceProtocol) protocol to install the event handlers you need. The returned dispatch source is in the inactive state initially. When you are ready to begin processing events, call its [`activate()`](/documentation/Dispatch/DispatchObject/activate()) method.

To schedule timers, use the methods of the [`DispatchSourceTimer`](/documentation/Dispatch/DispatchSourceTimer) protocol. You may schedule timers that fire once or fire multiple times. Each time the timer fires, the dispatch source calls your installed event handler.

---

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)