Skip to content

Instance MethodFoundationEssentials

append(path:directoryHint:)

iOS 16.0+ iPadOS 16.0+ Mac Catalyst 16.0+ macOS 13.0+ tvOS 16.0+ watchOS 9.0+
Appends a path to the URL, with a hint for handling directory awareness.
mutating func append<S>(path: S, directoryHint: URL.DirectoryHint = .inferFromPath) where S : StringProtocol

Parameters

path

The path to add.

directoryHint

A hint to whether this URL will point to a directory. Defaults to URL.DirectoryHint.inferFromPath.

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 append(component:directoryHint:) instead.