Instance Property

relativeString

The relative portion of a URL.

Declaration

var relativeString: String { get }

Discussion

If baseURL is nil, or if the receiver is itself absolute, this is the same as absoluteString.

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 fragment: String?

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

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 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.

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software