---
title: "appendingPathExtension(for:)"
framework: foundation
role: symbol
role_heading: Instance Method
path: "foundation/nsurl/appendingpathextension(for:)"
---

# appendingPathExtension(for:)

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

## Declaration

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

## Parameters

- `contentType`: The uniform type identifer to use for the extension.

## Return Value

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

## Discussion

Discussion For more information about types, see Uniform Type Identifiers.

## See Also

### Modifying and Converting a File URL

- [filePathURL](foundation/nsurl/filepathurl.md)
- [fileReferenceURL()](foundation/nsurl/filereferenceurl().md)
- [appendingPathComponent(_:)](foundation/nsurl/appendingpathcomponent(_:).md)
- [appendingPathComponent(_:isDirectory:)](foundation/nsurl/appendingpathcomponent(_:isdirectory:).md)
- [appendingPathComponent(_:conformingTo:)](foundation/nsurl/appendingpathcomponent(_:conformingto:).md)
- [appendingPathExtension(_:)](foundation/nsurl/appendingpathextension(_:).md)
- [deletingLastPathComponent](foundation/nsurl/deletinglastpathcomponent.md)
- [deletingPathExtension](foundation/nsurl/deletingpathextension.md)
- [resolvingSymlinksInPath](foundation/nsurl/resolvingsymlinksinpath.md)
- [standardizingPath](foundation/nsurl/standardizingpath.md)
- [hasDirectoryPath](foundation/nsurl/hasdirectorypath.md)
