annotatedString(from:)
Returns an attributed string formatted for a given NSPersonNameComponents object, with attribute annotations for each component.
Declaration
func annotatedString(from components: PersonNameComponents) -> NSAttributedStringParameters
- components:
A formatted string representation of the given name components.
Return Value
An attributed string representation of the given name components. You can determine the person component corresponding to a particular range of the attributed string by querying the NSPersonNameComponentKey attribute, providing one of the NSPersonNameComponent constant values defined below as the attribute value.
Discussion
Use this method to style individual components of a formatted name, such as a name in a label.