---
title: SystemFormatStyle.Stopwatch
framework: swiftui
role: symbol
role_heading: Structure
path: swiftui/systemformatstyle/stopwatch
---

# SystemFormatStyle.Stopwatch

A format style that displays elapsed time as a precision stopwatch counting up from zero.

## Declaration

```swift
struct Stopwatch
```

## Overview

Overview Stopwatch produces output in a time-pattern format that includes hundredths of a second by default, making it suitable for use cases such as athletic timing where sub-second precision matters. let startDate = Date.now Text(.currentDate, format: .stopwatch(startingAt: startDate)) // Output: "00:05.23" (after 5.23 seconds) Output format progression The stopwatch automatically adds an hours field when the elapsed time reaches one hour:  |   |   |   |   |  Adjusting precision Control the displayed precision with the maxPrecision parameter: // Whole-second precision (no fractional digits) .stopwatch(startingAt: start, maxPrecision: .seconds(1)) // Output: "01:23"

// Tenth-of-a-second precision (one fractional digit) .stopwatch(startingAt: start, maxPrecision: .milliseconds(100)) // Output: "01:23.4"

// Minute-only precision .stopwatch(startingAt: start, maxPrecision: .seconds(60)) // Output: "1 hour" or "23 minutes" Controlling field count The maxFieldCount parameter limits how many fields appear: // At 1 hour, 23 minutes, 45.67 seconds elapsed: // maxFieldCount: 4 (default): "01:23:45.67" // maxFieldCount: 3: "01:23:45" // maxFieldCount: 2: "1:23" (hours and minutes only)

## Topics

### Initializers

- [init(startingAt:showsHours:maxFieldCount:maxPrecision:)](swiftui/systemformatstyle/stopwatch/init(startingat: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)
