Contents

appendingPathComponent(_:)

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

Declaration

func appendingPathComponent(_ pathComponent: String) -> URL

Parameters

  • pathComponent:

    The path component to add.

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