Skip to content

Initializer

init(url:resolvingAgainstBaseURL:)

iOS 8.0+ iPadOS 8.0+ Mac Catalyst 8.0+ macOS 10.10+ tvOS 9.0+ watchOS 2.0+
Initializes URLComponents from a URL, optionally resolving against its base URL.
init?(url: URL, resolvingAgainstBaseURL resolve: Bool)

Discussion

If resolvingAgainstBaseURL is true and url is a relative URL, the components of url.absoluteURL are used. If the url string from the URL is malformed, nil is returned.