Skip to content

Instance Method

appendingPathComponent(_:)

iOS 8.0+Deprecated iPadOS 8.0+Deprecated Mac Catalyst 8.0+Deprecated macOS 10.10+Deprecated tvOS 9.0+Deprecated visionOS 1.0+Deprecated watchOS 2.0+Deprecated

Deprecated

Use appending(path:directoryHint:) instead

Returns a URL constructed by appending the given path component to self.
func appendingPathComponent(_ pathComponent: String) -> URL

Parameters

pathComponent

The path component to add.

Discussion

Note

This function performs a file system operation to determine if the path component is a directory. If so, it will append a trailing /. If you know in advance that the path component is a directory or not, then use func appendingPathComponent(_:isDirectory:).

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