<!--
{
  "availability" : [
    "iOS: 8.0.0 -",
    "iPadOS: 8.0.0 -",
    "macCatalyst: 13.1.0 -",
    "macOS: 10.10.0 -",
    "tvOS: 9.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 2.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Foundation",
  "identifier" : "/documentation/Foundation/NSURLQueryItem",
  "metadataVersion" : "0.1.0",
  "role" : "Class",
  "symbol" : {
    "kind" : "Class",
    "modules" : [
      "Foundation"
    ],
    "preciseIdentifier" : "c:objc(cs)NSURLQueryItem"
  },
  "title" : "NSURLQueryItem"
}
-->

# NSURLQueryItem

An object representing a single name/value pair for an item in the query portion of a URL.

```
class NSURLQueryItem
```

## Overview

In Swift, this object bridges to [`URLQueryItem`](/documentation/Foundation/URLQueryItem); use [`NSURLQueryItem`](/documentation/Foundation/NSURLQueryItem) when you need reference semantics or other Foundation-specific behavior.

You use query items with the [`queryItems`](/documentation/Foundation/NSURLComponents/queryItems) property of an [`NSURLComponents`](/documentation/Foundation/NSURLComponents) object.

> Important:
> The Swift overlay to the Foundation framework provides the ``doc://com.apple.foundation/documentation/Foundation/URLQueryItem`` structure, which bridges to the ``doc://com.apple.foundation/documentation/Foundation/NSURLQueryItem`` class. For more information about value types, see <doc://com.apple.documentation/documentation/Swift/working-with-foundation-types>.

## Topics

### Creating a Query Item

[`+  queryItemWithName:value:`](/documentation/Foundation/NSURLQueryItem/queryItemWithName:value:)

Creates a new query item with the specified name and value.

[`-  initWithName:value:`](/documentation/Foundation/NSURLQueryItem/init(name:value:))

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

### Reading a Query Item’s Name and Value

[`name`](/documentation/Foundation/NSURLQueryItem/name)

The name of the query item.

[`value`](/documentation/Foundation/NSURLQueryItem/value)

The value for the query item.

## Relationships

### Conforms To

[`Copyable`](/documentation/Swift/Copyable)

[`Sendable`](/documentation/Swift/Sendable)

[`SendableMetatype`](/documentation/Swift/SendableMetatype)

[`CVarArg`](/documentation/Swift/CVarArg)

[`NSObjectProtocol`](/documentation/ObjectiveC/NSObjectProtocol)

[`NSCopying`](/documentation/Foundation/NSCopying)

[`Escapable`](/documentation/Swift/Escapable)

[`NSSecureCoding`](/documentation/Foundation/NSSecureCoding)

[`Equatable`](/documentation/Swift/Equatable)

[`CustomStringConvertible`](/documentation/Swift/CustomStringConvertible)

[`NSCoding`](/documentation/Foundation/NSCoding)

[`Hashable`](/documentation/Swift/Hashable)

[`CustomDebugStringConvertible`](/documentation/Swift/CustomDebugStringConvertible)

### Inherits From

[`NSObject-swift.class`](/documentation/ObjectiveC/NSObject-swift.class)

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)