<!--
{
  "availability" : [
    "iOS: 11.0.0 -",
    "iPadOS: 11.0.0 -",
    "macCatalyst: 11.0.0 -",
    "macOS: 10.13.0 -",
    "tvOS: 11.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 4.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Foundation",
  "identifier" : "/documentation/Foundation/URLComponents/percentEncodedQueryItems",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Property",
  "symbol" : {
    "kind" : "Instance Property",
    "modules" : [
      "Foundation"
    ],
    "preciseIdentifier" : "s:10Foundation13URLComponentsV24percentEncodedQueryItemsSayAA12URLQueryItemVGSgvp"
  },
  "title" : "percentEncodedQueryItems"
}
-->

# percentEncodedQueryItems

The query subcomponent, as an array of percent-encoded query items.

```
var percentEncodedQueryItems: [URLQueryItem]? { get set }
```

## Discussion

The setter combines an array containing any number of [`URLQueryItem`](/documentation/Foundation/URLQueryItem) key-value pairs into a query string and sets the `URLComponents` query property. This property assumes the query item names and values are already correctly percent-encoded. It also assumes that the query item names don’t contain the query item delimiter characters `&` and `=`. Attempting to set an incorrectly percent-encoded query item or a query item name with the query item delimiter characters `&` and `=` raises <doc://com.apple.documentation/documentation/Swift/fatalError(_:file:line:)>.

---

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)