Contents

url(relativeTo:)

Returns a URL based on the component settings and relative to a given base URL.

Declaration

func url(relativeTo base: URL?) -> URL?

Discussion

If the NSURLComponents has an authority component (user, password, host or port) and a path component, then the path must either begin with “/” or be an empty string. If the NSURLComponents does not have an authority component (user, password, host or port) and has a path component, the path component must not start with “//”. If those requirements are not met, nil is returned.

See Also

Getting the URL