<!--
{
  "availability" : [
    "iOS: 26.0.0 -",
    "iPadOS: 26.0.0 -",
    "macCatalyst: 26.0.0 -",
    "macOS: 26.0.0 -",
    "tvOS: 26.0.0 -",
    "visionOS: 26.0.0 -",
    "watchOS: 26.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Foundation",
  "identifier" : "/documentation/Foundation/URL/Template/Value",
  "metadataVersion" : "0.1.0",
  "role" : "Structure",
  "symbol" : {
    "kind" : "Structure",
    "modules" : [
      "Foundation"
    ],
    "preciseIdentifier" : "s:10Foundation3URLV8TemplateV5ValueV"
  },
  "title" : "URL.Template.Value"
}
-->

# URL.Template.Value

The value of a variable used for expanding a template.

```
struct Value
```

## Overview

A value can either be some text, a list, or an associate list (a dictionary).

### Examples

```swift
let hello: URL.Template.Value = .text("Hello World!")
let list: URL.Template.Value = .list(["red", "green", "blue"])
let keys: URL.Template.Value = .associativeList([
    "semi": ";",
    "dot": ".",
    "comma": ",",
])
```

Alternatively, for constants, the `ExpressibleBy…Literal` implementations
can be used, i.e.

```swift
let hello: URL.Template.Value = "Hello World!"
let list: URL.Template.Value = ["red", "green", "blue"]
let keys: URL.Template.Value = [
    "semi": ";",
    "dot": ".",
    "comma": ",",
]
```

## Topics

### Type Methods

[`static func associativeList(some Sequence<(key: String, value: String)>) -> URL.Template.Value`](/documentation/Foundation/URL/Template/Value/associativeList(_:))

An associative list value (ordered key-value pairs) to be used with a `URL.Template`.

[`static func list(some Sequence<String>) -> URL.Template.Value`](/documentation/Foundation/URL/Template/Value/list(_:))

A list value (an array of `String`s) to be used with a `URL.Template`.

[`static func text(String) -> URL.Template.Value`](/documentation/Foundation/URL/Template/Value/text(_:))

A text value to be used with a `URL.Template`.

## Relationships

### Conforms To

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

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

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

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

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

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

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

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

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

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

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

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

---

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)