Instance Method インスタンスメソッド

format(_:)

Creates a string representation from a person name components value.

Declaration 宣言

func format(_ value: PersonNameComponents) -> String

Parameters パラメータ

value

The person name components object to format.

Return Value 戻り値

A string representation of the person name components.

Discussion 議論

The format(_:) instance method applies the style to an instance of PersonNameComponent. After creating a style, you can use it to format multiple instances of person name components. For example: 例えば:


let customPersonFormatStyle = PersonNameComponents.FormatStyle(style: .medium, locale: Locale(identifier: "us_EN"))


var person1 = PersonNameComponents()
person1.familyName = "Clark"
person1.givenName = "Thomas"
person1.middleName = "Louis"
person1.namePrefix = "Dr."
person1.nickname = "Tom"
person1.nameSuffix = "Esq."


let customPersonString1 = 
customPersonFormatStyle.format(person1)
// Thomas Clark


let customPersonString2 = 
customPersonFormatStyle.format(person2)
// Maria Ruiz

Relationships 関係

From Protocol 由来プロトコル