Instance Property

fragment

The fragment component of the URL if the URL conforms to RFC 1808 (the most common form of URL), otherwise nil.

Declaration

var fragment: String? { get }

Discussion

See Also

Accessing the Parts of a URL

var absoluteString: String

The absolute string for the URL.

var absoluteURL: URL

The absolute URL.

var baseURL: URL?

The base URL.

var host: String?

The host component of a URL if the URL conforms to RFC 1808 (the most common form of URL), otherwise nil.

var lastPathComponent: String

The last path component of the URL, or an empty string if the path is an empty string.

var path: String

The path component of the URL if the URL conforms to RFC 1808 (the most common form of URL), otherwise an empty string.

var pathComponents: [String]

The path components of the URL, or an empty array if the path is an empty string.

var pathExtension: String

The path extension of the URL, or an empty string if the path is an empty string.

var port: Int?

The port component of the URL if the URL conforms to RFC 1808 (the most common form of URL), otherwise nil.

var query: String?

The query of the URL if the URL conforms to RFC 1808 (the most common form of URL), otherwise nil.

var relativePath: String

The relative path of the URL if the URL conforms to RFC 1808 (the most common form of URL), otherwise nil.

var relativeString: String

The relative portion of a URL.

var scheme: String?

The scheme of the URL.

var standardized: URL

A version of the URL with any instances of “..” or “.” removed from its path.

var standardizedFileURL: URL

A standardized version of the path of a file URL.

var user: String?

The user component of the URL if the URL conforms to RFC 1808 (the most common form of URL), otherwise nil.

var password: String?

The password component of the URL if the URL conforms to RFC 1808 (the most common form of URL), otherwise nil.