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, thenameparameter isq. - value:
The value for the query item. For example, in the URL
http://www.apple.com/search/?q=iPad, thevalueparameter isiPad.
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.