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

# appendingPathExtension(_:)

Returns a new URL by appending a path extension to the original URL.

## Declaration

```swift
func appendingPathExtension(_ pathExtension: String) -> URL?
```

## Parameters

- `pathExtension`: The path extension to add to the URL.

## Return Value

Return Value A new URL with pathExtension appended.

## Discussion

Discussion If the original URL ends with one or more forward slashes, these are removed from the returned URL. A period is inserted between the two parts of the new URL.

## 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(for:)](foundation/nsurl/appendingpathextension(for:).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)
