Instance Property


An array of query items for the URL in the order in which they appear in the original query string.


var queryItems: [URLQueryItem]? { get set }


Each URLQueryItem represents a single key-value pair,

Note that a name may appear more than once in a single query string, so the name values are not guaranteed to be unique. If the URLComponents has an empty query component, returns an empty array. If the URLComponents has no query component, returns nil.

The setter combines an array containing any number of URLQueryItems, each of which represents a single key-value pair, into a query string and sets the URLComponents query property. Passing an empty array sets the query component of the URLComponents to an empty string. Passing nil removes the query component of the URLComponents.

See Also

Accessing Components in Native Format

var fragment: String?

The fragment subcomponent.

var host: String?

The host subcomponent.

var password: String?

The password subcomponent of the URL.

var path: String

The path subcomponent.

var port: Int?

The port subcomponent.

var query: String?

The query subcomponent.

var scheme: String?

The scheme subcomponent of the URL.

var user: String?

The user subcomponent of the URL.