<!--
{
  "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" : "Foundation",
  "identifier" : "/documentation/Foundation/Locale/init(components:)",
  "metadataVersion" : "0.1.0",
  "role" : "Initializer",
  "symbol" : {
    "kind" : "Initializer",
    "modules" : [
      "Foundation"
    ],
    "preciseIdentifier" : "s:10Foundation6LocaleV10componentsA2C10ComponentsV_tcfc"
  },
  "title" : "init(components:)"
}
-->

# init(components:)

Creates a locale from the given components.

```
init(components: Locale.Components)
```

## Parameters

`components`

A [`Locale.Components`](/documentation/Foundation/Locale/Components) instance that provides the components to create a customized locale.

## Discussion

Use this initializer to create a locale with a unique combination of components, beyond the defaults provided by a language and country code.

For example, you can create a [`Locale.Components`](/documentation/Foundation/Locale/Components) instance that uses UK language conventions, but US regional conventions for traits like currency and measurement. You then use the components to create a new [`Locale`](/documentation/Foundation/Locale) instance, like this:

```swift
var components = Locale.Components(languageCode: "en", languageRegion: "GB")
components.region = Locale.Region("US")
let en_GB_US = Locale(components: components)
```

---

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)