url(relativeTo:)
Returns a URL created from the URLComponents relative to a base URL.
- iOS
- 8.0+
- macOS
- 10.10+
- tvOS
- 9.0+
- watchOS
- 2.0+
func url(relativeTo base: URL?) -> URL?
If the URLComponents 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 URLComponents 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.