Contents

appending(component:directoryHint:)

Returns a URL by appending the specified path component to the URL, with a hint for handling directory awareness.

Declaration

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

Parameters

  • component:

    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 Inferfrompath.

Return Value

A new URL that appends the specified path to the original URL.

Discussion

For non-file URLs, this method percent-encodes any path separators (/) in the path component before appending.

See Also

Adding path components