Skip to content

StructureFoundationEssentials

URL.Template.Value

iOS 26.0+ iPadOS 26.0+ Mac Catalyst 26.0+ macOS 26.0+ tvOS 26.0+ visionOS 26.0+ watchOS 26.0+
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

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.

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

Default Implementations

Relationships

Conforms To

  • Swift.Copyable
  • Swift.CustomStringConvertible
  • Swift.Equatable
  • Swift.Escapable
  • Swift.ExpressibleByArrayLiteral
  • Swift.ExpressibleByDictionaryLiteral
  • Swift.ExpressibleByExtendedGraphemeClusterLiteral
  • Swift.ExpressibleByStringLiteral
  • Swift.ExpressibleByUnicodeScalarLiteral
  • Swift.Hashable
  • Swift.Sendable
  • Swift.SendableMetatype