Initializer

init(name:value:)

Initializes a newly allocated query item with the specified name and value.

Declaration

init(name: String, value: String?)

Parameters

name

The name of the query item. For example, in the URL http://www.apple.com/search/?q=iPad, the name parameter is q.

value

The value for the query item. For example, in the URL http://www.apple.com/search/?q=iPad, the value parameter is iPad.

Return Value

An initialized query item object.

Discussion

To use the newly initialized query item in composing a URL, add it to the queryItems array of an NSURLComponents instance. Because assigning an array of query items to an NSURLComponents instance automatically encodes the name and value properties, you should not percent-encode these strings.

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