Instance Property

pathComponents

An array containing the path components. (read-only)

Declaration

var pathComponents: [String]? { get }

Discussion

This property contains an array containing the individual path components of the URL, each unescaped using the replacingPercentEscapes(using:) method. For example, in the URL file:///directory/directory%202/file, the path components array would be @[@"/", @"directory", @"directory 2", @"file"].

See Also

Accessing the Parts of the URL

var absoluteString: String?

The URL string for the receiver as an absolute URL. (read-only)

var absoluteURL: URL?

An absolute URL that refers to the same resource as the receiver. (read-only)

var baseURL: URL?

The base URL. (read-only)

var fileSystemRepresentation: UnsafePointer<Int8>

A C string containing the URL’s file system path. (read-only)

var fragment: String?

The fragment identifier, conforming to RFC 1808. (read-only)

var host: String?

The host, conforming to RFC 1808. (read-only)

var lastPathComponent: String?

The last path component. (read-only)

var parameterString: String?

The parameter string conforming to RFC 1808. (read-only)

var password: String?

The password conforming to RFC 1808. (read-only)

var path: String?

The path, conforming to RFC 1808. (read-only)

var pathExtension: String?

The path extension. (read-only)

var port: NSNumber?

The port, conforming to RFC 1808.

var query: String?

The query string, conforming to RFC 1808.

var relativePath: String?

The relative path, conforming to RFC 1808. (read-only)

var relativeString: String

A string representation of the relative portion of the URL. (read-only)

var resourceSpecifier: String?

The resource specifier. (read-only)

var scheme: String?

The scheme. (read-only)

var standardized: URL?

A copy of the URL with any instances of ".." or "." removed from its path. (read-only)

var user: String?

The user name, conforming to RFC 1808.