---
title: "appendPathComponent(_:isDirectory:)"
framework: foundation
role: symbol
role_heading: Instance Method
path: "foundation/url/appendpathcomponent(_:isdirectory:)"
---

# appendPathComponent(_:isDirectory:)

Appends a path component to the URL, specifying whether the resulting path is a directory.

## Declaration

```swift
mutating func appendPathComponent(_ pathComponent: String, isDirectory: Bool)
```

## Parameters

- `pathComponent`: The path component to add.
- `isDirectory`: Use true if the resulting path is a directory.

## Discussion

Discussion New code should use append(path:directoryHint:) instead of this method.

## See Also

### Adding path components

- [append(path:directoryHint:)](foundation/url/append(path:directoryhint:).md)
- [append(component:directoryHint:)](foundation/url/append(component:directoryhint:).md)
- [appendPathComponent(_:)](foundation/url/appendpathcomponent(_:).md)
- [appending(path:directoryHint:)](foundation/url/appending(path:directoryhint:).md)
- [appending(component:directoryHint:)](foundation/url/appending(component:directoryhint:).md)
- [appendingPathComponent(_:)](foundation/url/appendingpathcomponent(_:).md)
- [appendingPathComponent(_:isDirectory:)](foundation/url/appendingpathcomponent(_:isdirectory:).md)
- [append(components:directoryHint:)](foundation/url/append(components:directoryhint:).md)
- [appending(components:directoryHint:)](foundation/url/appending(components:directoryhint:).md)
- [appendPathComponent(_:conformingTo:)](foundation/url/appendpathcomponent(_:conformingto:).md)
- [appendingPathComponent(_:conformingTo:)](foundation/url/appendingpathcomponent(_:conformingto:).md)
