Skip to content

Instance MethodFoundationEssentials

appending(path:directoryHint:)

iOS 16.0+ iPadOS 16.0+ Mac Catalyst 16.0+ macOS 13.0+ tvOS 16.0+ watchOS 9.0+
Returns a URL constructed by appending the given path to self.
func appending<S>(path: S, directoryHint: URL.DirectoryHint = .inferFromPath) -> URL where S : StringProtocol

Parameters

path

The path to add.

directoryHint

A hint to whether this URL will point to a directory.

Discussion

This method doesn’t percent-encode any path separators (/) in the path component before appending the component to the path. If you want this encoding, use appending(component:directoryHint:) instead.