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

# appending(components:directoryHint:)

Returns a new URL by appending multiple path components to the URL, with a hint for handling directory awareness.

## Declaration

```swift
func appending<S>(components: S..., directoryHint: URL.DirectoryHint = .inferFromPath) -> URL where S : StringProtocol
```

## Parameters

- `components`: The path components to add, as a variadic parameter.
- `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.

## Return Value

Return Value A new URL that appends the specified components to the original URL.

## 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)
- [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)
- [appendPathComponent(_:conformingTo:)](foundation/url/appendpathcomponent(_:conformingto:).md)
- [appendingPathComponent(_:conformingTo:)](foundation/url/appendingpathcomponent(_:conformingto:).md)
