---
title: "init(components:)"
framework: foundation
role: symbol
role_heading: Initializer
path: "foundation/locale/init(components:)"
---

# init(components:)

Creates a locale from the given components.

## Declaration

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

## Parameters

- `components`: A doc://com.apple.foundation/documentation/Foundation/Locale/Components instance that provides the components to create a customized locale.

## Discussion

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 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 instance, like this: var components = Locale.Components(languageCode: "en", languageRegion: "GB") components.region = Locale.Region("US") let en_GB_US = Locale(components: components)

## See Also

### Creating a locale by components

- [Locale.Components](foundation/locale/components.md)
- [init(languageCode:script:languageRegion:)](foundation/locale/init(languagecode:script:languageregion:).md)
- [init(languageComponents:)](foundation/locale/init(languagecomponents:).md)
- [Locale.Language.Components](foundation/locale/language-swift.struct/components.md)
