<!--
{
  "availability" : [
    "iOS: 18.0.0 -",
    "iPadOS: 18.0.0 -",
    "macCatalyst: 18.0.0 -",
    "macOS: 15.0.0 -",
    "tvOS: 18.0.0 -",
    "visionOS: 2.0.0 -",
    "watchOS: 11.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Swift",
  "identifier" : "/documentation/Synchronization/WordPair",
  "metadataVersion" : "0.1.0",
  "role" : "Structure",
  "symbol" : {
    "kind" : "Structure",
    "modules" : [
      "Synchronization"
    ],
    "preciseIdentifier" : "s:15Synchronization8WordPairV"
  },
  "title" : "WordPair"
}
-->

# WordPair

A pair of two word sized `UInt`s.

```
@frozen struct WordPair
```

## Overview

This type’s primary purpose is to be used in double wide atomic operations.
On platforms that support it, atomic operations on `WordPair` are done in a
single operation for two words. Users can use this type as itself when used
on `Atomic`, or it could be used as an intermediate step for custom
`AtomicRepresentable` types that are also double wide.

```
let atomicPair = Atomic<WordPair>(WordPair(first: 0, second: 0))
atomicPair.store(WordPair(first: someVersion, second: .max), ordering: .relaxed)
```

When used as an intermediate step for custom `AtomicRepresentable` types, it
is critical that their `AtomicRepresentation` be equal to
`WordPair.AtomicRepresentation`.

```
struct GridPoint {
  var x: Int
  var y: Int
}

extension GridPoint: AtomicRepresentable {
  typealias AtomicRepresentation = WordPair.AtomicRepresentation

  ...
}
```

> Note: This type only conforms to `AtomicRepresentable` on platforms that
> support double wide atomics.

## Topics

### Initializers

[`init(first: UInt, second: UInt)`](/documentation/Synchronization/WordPair/init(first:second:))

Initialize a new `WordPair` value given both individual words.

### Instance Properties

[`var first: UInt`](/documentation/Synchronization/WordPair/first)

The first element in this word pair.

[`var second: UInt`](/documentation/Synchronization/WordPair/second)

The second element in this word pair.

### Default Implementations

[AtomicRepresentable Implementations](/documentation/Synchronization/WordPair/AtomicRepresentable-Implementations)

[CustomDebugStringConvertible Implementations](/documentation/Synchronization/WordPair/CustomDebugStringConvertible-Implementations)

[CustomStringConvertible Implementations](/documentation/Synchronization/WordPair/CustomStringConvertible-Implementations)

[Equatable Implementations](/documentation/Synchronization/WordPair/Equatable-Implementations)

[Hashable Implementations](/documentation/Synchronization/WordPair/Hashable-Implementations)

## Relationships

### Conforms To

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

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

[`AtomicRepresentable`](/documentation/Synchronization/AtomicRepresentable)

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

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

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

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

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

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

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

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

---

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)