<!--
{
  "availability" : [
    "iOS: 14.0.0 -",
    "iPadOS: 14.0.0 -",
    "macCatalyst: 14.0.0 -",
    "macOS: 11.0.0 -",
    "tvOS: 14.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 7.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Foundation",
  "identifier" : "/documentation/Foundation/NSURL/appendingPathExtension(for:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Foundation"
    ],
    "preciseIdentifier" : "c:objc(cs)NSURL(im)URLByAppendingPathExtensionForType:"
  },
  "title" : "appendingPathExtension(for:)"
}
-->

# appendingPathExtension(for:)

Returns a URL by appending the path extension for a uniform type identifier.

```
func appendingPathExtension(for contentType: UTType) -> URL
```

## Parameters

`contentType`

The uniform type identifer to use for the extension.

## Return Value

A new URL with the type’s preferred extension appended.

## Discussion

For more information about types, see <doc://com.apple.documentation/documentation/UniformTypeIdentifiers>.

---

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)