<!--
{
  "availability" : [
    "iOS: 16.0.0 -",
    "iPadOS: 16.0.0 -",
    "macCatalyst: 16.0.0 -",
    "macOS: 13.0.0 -",
    "tvOS: 16.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 9.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Swift",
  "identifier" : "/documentation/Swift/Duration/TimeFormatStyle/init(pattern:locale:)",
  "metadataVersion" : "0.1.0",
  "role" : "Initializer",
  "symbol" : {
    "kind" : "Initializer",
    "modules" : [
      "Swift"
    ],
    "preciseIdentifier" : "s:s8DurationV10FoundationE15TimeFormatStyleV7pattern6localeA2E7PatternV_AC6LocaleVtcfc"
  },
  "title" : "init(pattern:locale:)"
}
-->

# init(pattern:locale:)

Creates a time format style using the provided pattern and optional locale.

```
init(pattern: Duration.TimeFormatStyle.Pattern, locale: Locale = .autoupdatingCurrent)
```

## Parameters

`pattern`

A `Pattern` that specifies the units to include in the displayed string and the behavior of the units.

`locale`

The `Locale` used to create the string representation of the duration. This parameter defaults to <doc://com.apple.documentation/documentation/Foundation/Locale/autoupdatingCurrent>.

---

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)