<!--
{
  "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/Swift/ObjectIdentifier/encodeAtomicOptionalRepresentation(_:)",
  "metadataVersion" : "0.1.0",
  "role" : "Type Method",
  "symbol" : {
    "kind" : "Type Method",
    "modules" : [
      "Swift"
    ],
    "preciseIdentifier" : "s:SO15SynchronizationE34encodeAtomicOptionalRepresentationyAA19_Atomic64BitStorageVSOSgnFZ"
  },
  "title" : "encodeAtomicOptionalRepresentation(_:)"
}
-->

# encodeAtomicOptionalRepresentation(_:)

Destroys a value of `Self` and prepares an `AtomicOptionalRepresentation`
storage type to be used for atomic operations on `Optional`.

```
static func encodeAtomicOptionalRepresentation(_ value: consuming ObjectIdentifier?) -> ObjectIdentifier.AtomicOptionalRepresentation
```

## Parameters

`value`

An optional instance of `Self` that’s about to be
destroyed to encode an instance of its `AtomicOptionalRepresentation`.

## Return Value

The newly encoded `AtomicOptionalRepresentation` storage.

## Discussion> Note: This is not an atomic operation. This simply encodes the logical
> type `Self` into its storage representation suitable for atomic
> operations, `AtomicOptionalRepresentation`.

---

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)