---
title: SystemFormatStyle.Timer
framework: swiftui
role: symbol
role_heading: Structure
path: swiftui/systemformatstyle/timer
---

# SystemFormatStyle.Timer

A format style that displays a countdown or count-up timer within a bounded time interval.

## Declaration

```swift
struct Timer
```

## Overview

Overview Timer produces a time-pattern output (like 4:32 or 1:23:45) that progresses between zero and the interval’s total duration. Unlike SystemFormatStyle.Stopwatch, a timer operates within a defined start and end date and can count in either direction. let start = Date.now let end = start.addingTimeInterval(600)

// Countdown from 10:00 to 0:00 Text(.currentDate, format: .timer(countingDownIn: start..<end))

// Count up from 0:00 to 10:00 Text(.currentDate, format: .timer(countingUpIn: start..<end)) Countdown behavior A countdown timer starts at the total interval duration and decreases to zero: // 5-minute countdown let start = Date.now let end = start.addingTimeInterval(300) Text(.currentDate, format: .timer(countingDownIn: start..<end))  |   |   |   |   |  Count-up behavior A count-up timer starts at zero and increases toward the total interval duration: // 1-hour count-up let start = Date.now let end = start.addingTimeInterval(3600) Text(.currentDate, format: .timer(countingUpIn: start..<end))  |   |   |   |   |  Hours display When showsHours is true (the default), the hours field appears once the displayed value reaches one hour. The transition between formats happens cleanly: // Countdown transition at the 1-hour boundary: // "1:00:00" -> "59:59" -> "59:58" -> ... When showsHours is false, minutes accumulate beyond 60: .timer(countingDownIn: start..<end, showsHours: false) // Output for 90 minutes remaining: "90:00" Precision control The maxPrecision parameter determines the smallest displayed unit: // Default (1 second): "4:32" .timer(countingDownIn: start..<end)

// Minute precision: shows "5 minutes", "4 minutes", etc. .timer(countingDownIn: start..<end, maxPrecision: .seconds(60))

## Topics

### Initializers

- [init(countingDownIn:showsHours:maxFieldCount:maxPrecision:)](swiftui/systemformatstyle/timer/init(countingdownin:showshours:maxfieldcount:maxprecision:).md)
- [init(countingUpIn:showsHours:maxFieldCount:maxPrecision:)](swiftui/systemformatstyle/timer/init(countingupin:showshours:maxfieldcount:maxprecision:).md)

## Relationships

### Conforms To

- [Copyable](swift/copyable.md)
- [Decodable](swift/decodable.md)
- [DiscreteFormatStyle](foundation/discreteformatstyle.md)
- [Encodable](swift/encodable.md)
- [Equatable](swift/equatable.md)
- [Escapable](swift/escapable.md)
- [FormatStyle](foundation/formatstyle.md)
- [Hashable](swift/hashable.md)
- [Sendable](swift/sendable.md)
- [SendableMetatype](swift/sendablemetatype.md)
