---
title: "timer(duration:attributes:stopIntent:secondaryIntent:sound:)"
framework: alarmkit
role: symbol
role_heading: Type Method
path: "alarmkit/alarmmanager/alarmconfiguration/timer(duration:attributes:stopintent:secondaryintent:sound:)"
---

# timer(duration:attributes:stopIntent:secondaryIntent:sound:)

Creates a configuration that behaves like a traditional timer.

## Declaration

```swift
static func timer(duration: TimeInterval, attributes: AlarmAttributes<Metadata>, stopIntent: (any LiveActivityIntent)? = nil, secondaryIntent: (any LiveActivityIntent)? = nil, sound: AlertConfiguration.AlertSound = .default) -> AlarmManager.AlarmConfiguration<Metadata>
```

## Parameters

- `duration`: The duration of the timer in seconds.
- `attributes`: The attributes to use when presenting the alert.
- `stopIntent`: The intent to execute when a person stops the timer.
- `secondaryIntent`: The intent to execute when a person taps the secondary button.
- `sound`: The sound to play when the alarm fires.

## Discussion

Discussion The timer starts immediately, runs for duration seconds, and then alerts. If you provide a secondary button with a behavior that indicates that the timer can repeat, the alert has a repeat button.

## See Also

### Configuring a countdown

- [init(countdownDuration:schedule:attributes:stopIntent:secondaryIntent:sound:)](alarmkit/alarmmanager/alarmconfiguration/init(countdownduration:schedule:attributes:stopintent:secondaryintent:sound:).md)
