<!--
{
  "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",
  "metadataVersion" : "0.1.0",
  "role" : "Enumeration",
  "symbol" : {
    "kind" : "Enumeration",
    "modules" : [
      "SwiftUI"
    ],
    "preciseIdentifier" : "s:7SwiftUI17SystemFormatStyleO"
  },
  "title" : "SystemFormatStyle"
}
-->

# SystemFormatStyle

A collection of format styles for displaying live-updating time
information in text views.

```
enum SystemFormatStyle
```

## Overview

Use the format styles in this namespace to present time-based data
in [`Text`](/documentation/SwiftUI/Text) views that automatically updates as the system clock
advances. Each style formats a
<doc://com.apple.documentation/documentation/Foundation/Date> value into an
<doc://com.apple.documentation/documentation/Foundation/AttributedString>
and conforms to both `FormatStyle` and `DiscreteFormatStyle`,
allowing SwiftUI to efficiently schedule text updates at exactly the
right moments.

You typically use these styles with the
[`init(_:format:)`](/documentation/SwiftUI/Text/init(_:format:)-8sfgg) initializer:

```swift
let startDate = Date.now
let endDate = startDate.addingTimeInterval(300)

Text(.currentDate, format: .offset(to: startDate))
// Output: "3 minutes, 42 seconds"

Text(.currentDate, format: .stopwatch(startingAt: startDate))
// Output: "00:03.42"

Text(.currentDate, format: .timer(countingDownIn: startDate..<endDate))
// Output: "4:17"

Text(.currentDate, format: .reference(to: endDate))
// Output: "in 5 minutes"
```

## Choosing a Style

|Style                                                                            |Purpose                                        |Example Output             |
|---------------------------------------------------------------------------------|-----------------------------------------------|---------------------------|
|``doc://com.apple.SwiftUI/documentation/SwiftUI/SystemFormatStyle/DateOffset``   |Elapsed time since or until a date             |`3 minutes, 42 seconds`    |
|``doc://com.apple.SwiftUI/documentation/SwiftUI/SystemFormatStyle/Stopwatch``    |Precision stopwatch counting up                |`00:03.42`                 |
|``doc://com.apple.SwiftUI/documentation/SwiftUI/SystemFormatStyle/Timer``        |Countdown or count-up within a bounded interval|`4:17`                     |
|``doc://com.apple.SwiftUI/documentation/SwiftUI/SystemFormatStyle/DateReference``|Natural-language reference to a date           |`in 5 minutes`, `yesterday`|

## Topics

### Structures

[`struct DateOffset`](/documentation/SwiftUI/SystemFormatStyle/DateOffset)

A format style that displays the time offset between a
comparison date and an anchor date that you provide.

[`struct DateReference`](/documentation/SwiftUI/SystemFormatStyle/DateReference)

A format style that refers to a date using the most natural
phrasing based on how much time separates it from the current time.

[`struct Stopwatch`](/documentation/SwiftUI/SystemFormatStyle/Stopwatch)

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

[`struct Timer`](/documentation/SwiftUI/SystemFormatStyle/Timer)

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

## Relationships

### Conforms To

[`SendableMetatype`](/documentation/Swift/SendableMetatype)

[`Sendable`](/documentation/Swift/Sendable)

---

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)