One Logo Pool Ball
Foundation · IOS API REFERENCE

Locale.Components

struct · iOS 16.0+ · SDK 27.1

struct Components

A type that represents the components of a locale, for use when creating a locale with specific overrides.

Members (27)

get · iOS 16.0+

languageComponents

TypeScript
get languageComponents(): Locale_Language_Components
Swift declaration
var languageComponents: Locale.Language.Components

Represents the language identifier a locale

set · iOS 16.0+

languageComponents

TypeScript
set languageComponents(value: Locale_Language_Components)
Swift declaration
var languageComponents: Locale.Language.Components

Represents the language identifier a locale

init · iOS 16.0+

init

TypeScript
static initIdentifier(identifier: string): Locale_Components
Swift declaration
init(identifier: String)

Creates a locale components instance with the specified identifier. - Parameter identifier: A BCP-47 language identifier such as `en-u-nu-thai-ca-buddhist` or an ICU-style identifier such as `en@calendar=buddhist;numbers=thai`.

get · iOS 16.0+

subdivision

TypeScript
get subdivision(): (Locale_Subdivision) | null
Swift declaration
var subdivision: Locale.Subdivision?

Set this to override the regional subdivision of `region` Corresponds to the "sd" key of the Unicode BCP 47 extension

set · iOS 16.0+

subdivision

TypeScript
set subdivision(value: (Locale_Subdivision) | null)
Swift declaration
var subdivision: Locale.Subdivision?

Set this to override the regional subdivision of `region` Corresponds to the "sd" key of the Unicode BCP 47 extension

init · iOS 16.0+

init

TypeScript
static initLanguageCodeScriptLanguageRegion(languageCode?: (Locale_LanguageCode) | null, script?: (Locale_Script) | null, languageRegion?: (Locale_Region) | null): Locale_Components
Swift declaration
init(languageCode: Locale.LanguageCode? = nil, script: Locale.Script? = nil, languageRegion: Locale.Region? = nil)

Creates a `Locale.Components` with the specified language code, script and region for the language

get · iOS 16.0+

firstDayOfWeek

TypeScript
get firstDayOfWeek(): (Locale_Weekday) | null
Swift declaration
var firstDayOfWeek: Locale.Weekday?

Set this to override the first day of the week. To request the default first day of the week preferred by the locale, use `Locale.firstDayOfWeek` Corresponds to the "fw" key of the Unicode BCP 47 extension The preferred first day of the week that should be shown in a calendar view. Not necessarily the same as the first day after the weekend, and should not be determined from the weekend information

set · iOS 16.0+

firstDayOfWeek

TypeScript
set firstDayOfWeek(value: (Locale_Weekday) | null)
Swift declaration
var firstDayOfWeek: Locale.Weekday?

Set this to override the first day of the week. To request the default first day of the week preferred by the locale, use `Locale.firstDayOfWeek` Corresponds to the "fw" key of the Unicode BCP 47 extension The preferred first day of the week that should be shown in a calendar view. Not necessarily the same as the first day after the weekend, and should not be determined from the weekend information

get · iOS 16.0+

numberingSystem

TypeScript
get numberingSystem(): (Locale_NumberingSystem) | null
Swift declaration
var numberingSystem: Locale.NumberingSystem?

Set this to override the numbering system. To request the default numbering system used by the locale, use `Locale.numberingSystem` Corresponds to the "nu" key of the Unicode BCP 47 extension

set · iOS 16.0+

numberingSystem

TypeScript
set numberingSystem(value: (Locale_NumberingSystem) | null)
Swift declaration
var numberingSystem: Locale.NumberingSystem?

Set this to override the numbering system. To request the default numbering system used by the locale, use `Locale.numberingSystem` Corresponds to the "nu" key of the Unicode BCP 47 extension

get · iOS 16.0+

measurementSystem

TypeScript
get measurementSystem(): (Locale_MeasurementSystem) | null
Swift declaration
var measurementSystem: Locale.MeasurementSystem?

Set this to override the measurement system. To request the default measurement system, use `Locale.measurementSystem` Corresponds to the "ms" key of the Unicode BCP 47 extension

set · iOS 16.0+

measurementSystem

TypeScript
set measurementSystem(value: (Locale_MeasurementSystem) | null)
Swift declaration
var measurementSystem: Locale.MeasurementSystem?

Set this to override the measurement system. To request the default measurement system, use `Locale.measurementSystem` Corresponds to the "ms" key of the Unicode BCP 47 extension

init · iOS 16.0+

init

TypeScript
static initLocale(locale: Locale): Locale_Components
Swift declaration
init(locale: Locale)

Creates a `Locale.Components` with the identifier of the specified `locale`. - Parameter locale: The locale whose identifier is used to create the component. If `Locale.current` or `Locale.autoupdatingCurrent` is specified, the created `Locale.Components` will contain user's preferred values as set in the system settings if available.

get · iOS 16.0+

region

TypeScript
get region(): (Locale_Region) | null
Swift declaration
var region: Locale.Region?

The region used by the locale. Set this property to override the region for region-related preferences, such as measuring system, calendar, and first day of the week. If unset, the locale uses the region of the language component. This property corresponds to the `rg` key of the Unicode BCP 47 extension.

set · iOS 16.0+

region

TypeScript
set region(value: (Locale_Region) | null)
Swift declaration
var region: Locale.Region?

The region used by the locale. Set this property to override the region for region-related preferences, such as measuring system, calendar, and first day of the week. If unset, the locale uses the region of the language component. This property corresponds to the `rg` key of the Unicode BCP 47 extension.

get · iOS 16.0+

variant

TypeScript
get variant(): (Locale_Variant) | null
Swift declaration
var variant: Locale.Variant?

Set this to specify a variant used for the locale Corresponds to the "va" key of the Unicode BCP 47 extension

set · iOS 16.0+

variant

TypeScript
set variant(value: (Locale_Variant) | null)
Swift declaration
var variant: Locale.Variant?

Set this to specify a variant used for the locale Corresponds to the "va" key of the Unicode BCP 47 extension

get · iOS 16.0+

calendar

TypeScript
get calendar(): (Calendar_Identifier) | null
Swift declaration
var calendar: Calendar.Identifier?

Set this to override the default calendar. To request the default calendar used by the locale, use `Locale.calendar` Corresponds to the "ca" key of the Unicode BCP 47 extension

set · iOS 16.0+

calendar

TypeScript
set calendar(value: (Calendar_Identifier) | null)
Swift declaration
var calendar: Calendar.Identifier?

Set this to override the default calendar. To request the default calendar used by the locale, use `Locale.calendar` Corresponds to the "ca" key of the Unicode BCP 47 extension

get · iOS 16.0+

currency

TypeScript
get currency(): (Locale_Currency) | null
Swift declaration
var currency: Locale.Currency?

Set this to override the currency. To request the default currency used by the locale, use `Locale.currency` Corresponds to the "cu" key of the Unicode BCP 47 extension

set · iOS 16.0+

currency

TypeScript
set currency(value: (Locale_Currency) | null)
Swift declaration
var currency: Locale.Currency?

Set this to override the currency. To request the default currency used by the locale, use `Locale.currency` Corresponds to the "cu" key of the Unicode BCP 47 extension

get · iOS 16.0+

timeZone

TypeScript
get timeZone(): (TimeZone) | null
Swift declaration
var timeZone: TimeZone?

Set this to specify a time zone to associate with this locale Corresponds to the "tz" key of the Unicode BCP 47 extension

set · iOS 16.0+

timeZone

TypeScript
set timeZone(value: (TimeZone) | null)
Swift declaration
var timeZone: TimeZone?

Set this to specify a time zone to associate with this locale Corresponds to the "tz" key of the Unicode BCP 47 extension

get · iOS 16.0+

collation

TypeScript
get collation(): (Locale_Collation) | null
Swift declaration
var collation: Locale.Collation?

Set this to override the string sort order. To request the default calendar used by the locale, use `Locale.calendar` Corresponds to the "co" key of the Unicode BCP 47 extension

set · iOS 16.0+

collation

TypeScript
set collation(value: (Locale_Collation) | null)
Swift declaration
var collation: Locale.Collation?

Set this to override the string sort order. To request the default calendar used by the locale, use `Locale.calendar` Corresponds to the "co" key of the Unicode BCP 47 extension

get · iOS 16.0+

hourCycle

TypeScript
get hourCycle(): (Locale_HourCycle) | null
Swift declaration
var hourCycle: Locale.HourCycle?

Set this to override the hour cycle. To request the default hour cycle, use `Locale.hourCycle` Corresponds to the "hc" key

set · iOS 16.0+

hourCycle

TypeScript
set hourCycle(value: (Locale_HourCycle) | null)
Swift declaration
var hourCycle: Locale.HourCycle?

Set this to override the hour cycle. To request the default hour cycle, use `Locale.hourCycle` Corresponds to the "hc" key

Skipped declarations

No declarations were skipped in this snapshot.

All Foundation types →