---
title: deletingLastPathComponent
framework: foundation
role: symbol
role_heading: Instance Property
path: foundation/nsurl/deletinglastpathcomponent
---

# deletingLastPathComponent

A URL you create by removing the last path component from the receiver. (read-only)

## Declaration

```swift
var deletingLastPathComponent: URL? { get }
```

## Discussion

Discussion If the receiver’s URL represents the root path, this property contains a copy of the original URL. Otherwise, if the original URL has only one path component, this property contains the empty string.

## 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)
- [appendingPathExtension(for:)](foundation/nsurl/appendingpathextension(for:).md)
- [deletingPathExtension](foundation/nsurl/deletingpathextension.md)
- [resolvingSymlinksInPath](foundation/nsurl/resolvingsymlinksinpath.md)
- [standardizingPath](foundation/nsurl/standardizingpath.md)
- [hasDirectoryPath](foundation/nsurl/hasdirectorypath.md)
