<!--
{
  "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(countingUpIn:showsHours:maxFieldCount:maxPrecision:)",
  "metadataVersion" : "0.1.0",
  "role" : "Initializer",
  "symbol" : {
    "kind" : "Initializer",
    "modules" : [
      "SwiftUI"
    ],
    "preciseIdentifier" : "s:7SwiftUI17SystemFormatStyleO5TimerV12countingUpIn10showsHours13maxFieldCount0L9PrecisionAESny10Foundation4DateVG_SbSis8DurationVtcfc"
  },
  "title" : "init(countingUpIn:showsHours:maxFieldCount:maxPrecision:)"
}
-->

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

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

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

## Parameters

`interval`

The time interval during which the timer
counts up.

`showsHours`

If `true`, hours appear as a separate
element when the elapsed time reaches 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 elapsed time, starting from zero
and increasing toward the total interval duration.

---

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)