---
title: "appendingPathComponent(_:)"
framework: foundation
role: symbol
role_heading: Instance Method
path: "foundation/url/appendingpathcomponent(_:)"
---

# appendingPathComponent(_:)

Returns a URL by appending the specified path component to self.

## Declaration

```swift
func appendingPathComponent(_ pathComponent: String) -> URL
```

## Parameters

- `pathComponent`: The path component to add.

## Discussion

Discussion For file URLs, this method may perform file system I/O to determine if the path component is a directory, and, if so, it appends a trailing slash /. Use appendingPathComponent(_:isDirectory:) if you know the component’s file system object type in advance. New code should use appending(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)
- [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(_: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)
