URL

extension URL: TLDExtractable

An extension of URL that conforms to the TLDExtractable protocol. This extension provides functionality to initialize a URL from a Unicode string and to extract the hostname from the URL.

  • The hostname extracted from the URL.

    Declaration

    Swift

    public var hostname: String? { get }

    Return Value

    A string representing the hostname, or nil if it cannot be extracted.