init(components:)
Creates a locale from the given components.
Declaration
init(components: Locale.Components)Parameters
- components:
A 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 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)