---
title: pathComponents
framework: foundation
role: symbol
role_heading: Instance Property
path: foundation/nsurl/pathcomponents
---

# pathComponents

An array containing the  path components. (read-only)

## Declaration

```swift
var pathComponents: [String]? { get }
```

## Discussion

Discussion This property contains an array containing the individual path components of the URL, each unescaped using the replacingPercentEscapes(using:) method. For example, in the URL file:///directory/directory%202/file, the path components array would be @[@"/", @"directory", @"directory 2", @"file"].

## See Also

### Accessing the Parts of the URL

- [absoluteString](foundation/nsurl/absolutestring.md)
- [absoluteURL](foundation/nsurl/absoluteurl.md)
- [baseURL](foundation/nsurl/baseurl.md)
- [fileSystemRepresentation](foundation/nsurl/filesystemrepresentation.md)
- [fragment](foundation/nsurl/fragment.md)
- [host](foundation/nsurl/host.md)
- [lastPathComponent](foundation/nsurl/lastpathcomponent.md)
- [parameterString](foundation/nsurl/parameterstring.md)
- [password](foundation/nsurl/password.md)
- [path](foundation/nsurl/path.md)
- [pathExtension](foundation/nsurl/pathextension.md)
- [port](foundation/nsurl/port.md)
- [query](foundation/nsurl/query.md)
- [relativePath](foundation/nsurl/relativepath.md)
- [relativeString](foundation/nsurl/relativestring.md)
