One Logo Pool Ball
Synchronization · IOS API REFERENCE

WordPair

struct · iOS 18.0+ · SDK 27.1

@frozen struct WordPair

A pair of two word sized `UInt`s. 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.

Members (9)

get · iOS 18.0+

description

TypeScript
get description(): string
Swift declaration
var description: String { get }

A string that represents the contents of the word pair.

get · iOS 18.0+

debugDescription

TypeScript
get debugDescription(): string
Swift declaration
var debugDescription: String { get }

A string that represents the contents of the word pair, suitable for debugging.

static · iOS 18.0+

decodeAtomicRepresentation

TypeScript
static decodeAtomicRepresentation(representation: WordPair_AtomicRepresentation): WordPair
Swift declaration
static func decodeAtomicRepresentation(_ representation: consuming WordPair.AtomicRepresentation) -> WordPair

Recovers the logical atomic type `Self` by destroying some `AtomicRepresentation` storage instance returned from an atomic operation. - Note: This is not an atomic operation. This simply decodes the storage representation used in atomic operations back into the logical type for normal use, `Self`. - Parameter representation: The storage representation for `Self` that's used within atomic operations. - Returns: The newly decoded logical type `Self`.

static · iOS 18.0+

encodeAtomicRepresentation

TypeScript
static encodeAtomicRepresentation(value: WordPair): WordPair_AtomicRepresentation
Swift declaration
static func encodeAtomicRepresentation(_ value: consuming WordPair) -> WordPair.AtomicRepresentation

Destroys a value of `Self` and prepares an `AtomicRepresentation` storage type to be used for atomic operations. - Note: This is not an atomic operation. This simply encodes the logical type `Self` into its storage representation suitable for atomic operations, `AtomicRepresentation`. - Parameter value: A valid instance of `Self` that's about to be destroyed to encode an instance of its `AtomicRepresentation`. - Returns: The newly encoded `AtomicRepresentation` storage.

init · iOS 18.0+

init

TypeScript
static init(first: number, second: number): WordPair
Swift declaration
init(first: UInt, second: UInt)

Initialize a new `WordPair` value given both individual words. - Parameter first: The first word to use in the pair. - Parameter second: The second word to use in the pair.

get · iOS 18.0+

first

TypeScript
get first(): number
Swift declaration
var first: UInt

The first element in this word pair.

set · iOS 18.0+

first

TypeScript
set first(value: number)
Swift declaration
var first: UInt

The first element in this word pair.

get · iOS 18.0+

second

TypeScript
get second(): number
Swift declaration
var second: UInt

The second element in this word pair.

set · iOS 18.0+

second

TypeScript
set second(value: number)
Swift declaration
var second: UInt

The second element in this word pair.

Skipped declarations

No declarations were skipped in this snapshot.

All Synchronization types →