---
title: "localizedString(from:style:options:)"
framework: foundation
role: symbol
role_heading: Type Method
path: "foundation/personnamecomponentsformatter/localizedstring(from:style:options:)"
---

# localizedString(from:style:options:)

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

## Declaration

```swift
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 doc://com.apple.foundation/documentation/Foundation/PersonNameComponentsFormatter/Style-swift.enum.
- `nameOptions`: The formatting options for the name components. For possible values, see doc://com.apple.foundation/documentation/Foundation/PersonNameComponentsFormatter/Options.

## Return Value

Return Value A formatted string representation of the given name components.

## Discussion

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

- [string(from:)](foundation/personnamecomponentsformatter/string(from:).md)
- [annotatedString(from:)](foundation/personnamecomponentsformatter/annotatedstring(from:).md)
- [personNameComponents(from:)](foundation/personnamecomponentsformatter/personnamecomponents(from:).md)
- [getObjectValue(_:for:errorDescription:)](foundation/personnamecomponentsformatter/getobjectvalue(_:for:errordescription:).md)
