Contents

localizedString(from:style:options:)

Returns a string formatted for a given NSPersonNameComponents object using the provided style and options.

Declaration

class func localizedString(from components: PersonNameComponents, style nameFormatStyle: PersonNameComponentsFormatter.Style, options nameOptions: PersonNameComponentsFormatter.Options = []) -> String

Parameters

  • components:

    The name components to be formatted.

  • nameFormatStyle:

    A format style for the name components. For possible values, see Style Swift.enum.

  • nameOptions:

    The formatting options for the name components. For possible values, see Options.

Return Value

A formatted string representation of the given name components.

Discussion

This method is a convenience for formatting name components without creating an instance of NSPersonNameComponentsFormatter. For greater customizability, you can create an instance of NSPersonNameComponentsFormatter and use string(from:) instead.

See Also

Converting Between Person Name Components and Strings