<!--
{
  "availability" : [
    "iOS: 18.0.0 -",
    "iPadOS: 18.0.0 -",
    "macCatalyst: 18.0.0 -",
    "macOS: 15.0.0 -",
    "tvOS: 18.0.0 -",
    "visionOS: 2.0.0 -",
    "watchOS: 11.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "SwiftUI",
  "identifier" : "/documentation/SwiftUI/SystemFormatStyle/Timer/init(countingDownIn:showsHours:maxFieldCount:maxPrecision:)",
  "metadataVersion" : "0.1.0",
  "role" : "Initializer",
  "symbol" : {
    "kind" : "Initializer",
    "modules" : [
      "SwiftUI"
    ],
    "preciseIdentifier" : "s:7SwiftUI17SystemFormatStyleO5TimerV14countingDownIn10showsHours13maxFieldCount0L9PrecisionAESny10Foundation4DateVG_SbSis8DurationVtcfc"
  },
  "title" : "init(countingDownIn:showsHours:maxFieldCount:maxPrecision:)"
}
-->

# init(countingDownIn:showsHours:maxFieldCount:maxPrecision:)

Creates a timer format style that counts down within the
interval you provide.

```
init(countingDownIn interval: Range<Date>, showsHours: Bool = true, maxFieldCount: Int = 3, maxPrecision: Duration = .seconds(1))
```

## Parameters

`interval`

The time interval during which the timer
counts down.

`showsHours`

If `true`, hours appear as a separate
element when the remaining time is at least one hour.
If `false`, minutes accumulate beyond 60.

`maxFieldCount`

The maximum number of fields shown at
once. With the default of 3, output includes hours,
minutes, and seconds. With 2, it shows hours and
minutes once the time reaches hours.

`maxPrecision`

The smallest time interval between
display updates. Defaults to 1 second.

## Discussion

The timer displays the remaining time, starting from the
total interval duration and decreasing to zero.

---

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)