<!--
{
  "availability" : [
    "iOS: 15.0.0 -",
    "iPadOS: 15.0.0 -",
    "macCatalyst: 15.0.0 -",
    "macOS: 12.0.0 -",
    "tvOS: 15.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 8.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Foundation",
  "identifier" : "/documentation/Foundation/ParseableFormatStyle/name(style:)",
  "metadataVersion" : "0.1.0",
  "role" : "Type Method",
  "symbol" : {
    "kind" : "Type Method",
    "modules" : [
      "Foundation"
    ],
    "preciseIdentifier" : "s:10Foundation20ParseableFormatStylePA2A20PersonNameComponentsV0cD0VRszrlE4name5styleA2G0D0O_tFZ"
  },
  "title" : "name(style:)"
}
-->

# name(style:)

Returns a format style to use the given name style for formatting a name from its components.

```
static func name(style: PersonNameComponents.FormatStyle.Style) -> Self
```

## Parameters

`style`

A name-formatting style, such as
[`PersonNameComponents.FormatStyle.Style.long`](/documentation/Foundation/PersonNameComponents/FormatStyle/Style-swift.enum/long) or
[`PersonNameComponents.FormatStyle.Style.abbreviated`](/documentation/Foundation/PersonNameComponents/FormatStyle/Style-swift.enum/abbreviated).

## Return Value

A name format style.

## Discussion

Use the dot-notation form of this type method when the call point allows the use of
[`PersonNameComponents.FormatStyle`](/documentation/Foundation/PersonNameComponents/FormatStyle). You typically do this when calling the
[`formatted(_:)`](/documentation/Foundation/PersonNameComponents/formatted(_:)) method of [`PersonNameComponents`](/documentation/Foundation/PersonNameComponents).

The following example shows the effect of creating and using different person name
format styles.

```swift
let name = PersonNameComponents(namePrefix: "Dr.",
                                givenName: "Thomas",
                                middleName: "Louis",
                                familyName: "Clark",
                                nameSuffix: "Jr.",
                                nickname: "Tom")
let longFormattedName = name.formatted(.name(style: .long)) // "Dr. Thomas Louis Clark Jr."
let mediumFormattedName = name.formatted(.name(style: .medium)) // "Thomas Clark"
let shortFormattedName = name.formatted(.name(style: .short)) // "Tom"
let abbreviatedFormattedName = name.formatted(.name(style: .abbreviated)) // "TC"
```

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)