Skip to content

Instance Property

rangeOfHost

iOS 9.0+ iPadOS 9.0+ Mac Catalyst 9.0+ macOS 10.11+ tvOS 9.0+ watchOS 2.0+
The character range of the host in the string property.
var rangeOfHost: Range<String.Index>? { get }

Discussion

If the component does not exist, nil is returned.

Note

Zero length components are legal. For example, the URL string “scheme://:@/?#” has a zero length user, password, host, query and fragment; the URL strings “scheme:” and “” both have a zero length path.