---
title: "makeTimerSource(flags:queue:)"
framework: dispatch
role: symbol
role_heading: Type Method
path: "dispatch/dispatchsource/maketimersource(flags:queue:)"
---

# makeTimerSource(flags:queue:)

Creates a new dispatch source object for monitoring timer events.

## Declaration

```swift
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 doc://com.apple.dispatch/documentation/Dispatch/DispatchSource/TimerFlags.
- `queue`: The dispatch queue to which to execute the installed handlers.

## Return Value

Return Value A dispatch source object that conforms to the DispatchSourceTimer protocol.

## Discussion

Discussion After creating the dispatch source, use the methods of the 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() method. To schedule timers, use the methods of the 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.

## See Also

### Creating a Timer Source

- [DispatchSourceTimer](dispatch/dispatchsourcetimer.md)
- [DispatchSource.TimerFlags](dispatch/dispatchsource/timerflags.md)
