---
title: "append(path:directoryHint:)"
framework: foundation
role: symbol
role_heading: Instance Method
path: "foundation/url/append(path:directoryhint:)"
---

# append(path:directoryHint:)

Appends a path to the URL, with a hint for handling directory awareness.

## Declaration

```swift
mutating func append<S>(path: S, directoryHint: URL.DirectoryHint = .inferFromPath) where S : StringProtocol
```

## Parameters

- `path`: The path component to add.
- `directoryHint`: A hint to the initializer to indicate whether the path is a directory, or to instruct the method to make this determination. Defaults to doc://com.apple.foundation/documentation/Foundation/URL/DirectoryHint/inferFromPath.

## Discussion

Discussion This method doesn’t percent-encode any path separators (/) in the path component before appending the component to the path. If you want this encoding, use append(component:directoryHint:) instead.

## See Also

### Adding path components

- [append(component:directoryHint:)](foundation/url/append(component:directoryhint:).md)
- [appendPathComponent(_:)](foundation/url/appendpathcomponent(_:).md)
- [appendPathComponent(_:isDirectory:)](foundation/url/appendpathcomponent(_:isdirectory:).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)
