Skip to content

Instance Method

appendingPathExtension(_:)

iOS 8.0+ iPadOS 8.0+ Mac Catalyst 8.0+ macOS 10.10+ tvOS 9.0+ watchOS 2.0+
Returns a URL constructed by appending the given path extension to self.
func appendingPathExtension(_ pathExtension: String) -> URL

Parameters

pathExtension

The extension to append.

Discussion

If the URL has an empty path (e.g., http://www.example.com), then this function will return the URL unchanged.

Certain special characters (for example, Unicode Right-To-Left marks) cannot be used as path extensions. If any of those are contained in pathExtension, the function will return the URL unchanged.