<!--
{
  "availability" : [
    "iOS: 8.0.0 -",
    "iPadOS: 8.0.0 -",
    "macCatalyst: 13.0.0 -",
    "macOS: 10.10.0 -",
    "tvOS: 9.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 2.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Swift",
  "identifier" : "/documentation/Swift/AutoreleasingUnsafeMutablePointer",
  "metadataVersion" : "0.1.0",
  "role" : "Structure",
  "symbol" : {
    "kind" : "Structure",
    "modules" : [
      "Swift"
    ],
    "preciseIdentifier" : "s:SA"
  },
  "title" : "AutoreleasingUnsafeMutablePointer"
}
-->

# AutoreleasingUnsafeMutablePointer

A mutable pointer addressing an Objective-C reference that doesn’t own its
target.

```
@frozen struct AutoreleasingUnsafeMutablePointer<Pointee>
```

## Overview

`Pointee` must be a class type or `Optional<C>` where `C` is a class.

This type has implicit conversions to allow passing any of the following
to a C or ObjC API:

- `nil`, which gets passed as a null pointer,
- an inout argument of the referenced type, which gets passed as a pointer
  to a writeback temporary with autoreleasing ownership semantics,
- an `UnsafeMutablePointer<Pointee>`, which is passed as-is.

Passing pointers to mutable arrays of ObjC class pointers is not
directly supported. Unlike `UnsafeMutablePointer<Pointee>`,
`AutoreleasingUnsafeMutablePointer<Pointee>` must reference storage that
does not own a reference count to the referenced
value. UnsafeMutablePointer’s operations, by contrast, assume that
the referenced storage owns values loaded from or stored to it.

This type does not carry an owner pointer unlike the other C*Pointer types
because it only needs to reference the results of inout conversions, which
already have writeback-scoped lifetime.

## Topics

### Converting Pointers

[`init(_:)`](/documentation/Swift/AutoreleasingUnsafeMutablePointer/init(_:)-7rndr)

Explicit construction from an UnsafeMutablePointer.

[`init(_:)`](/documentation/Swift/AutoreleasingUnsafeMutablePointer/init(_:)-4mrz1)

Explicit construction from an UnsafeMutablePointer.

### Accessing a Pointer’s Memory

[`pointee`](/documentation/Swift/AutoreleasingUnsafeMutablePointer/pointee)

Retrieve or set the `Pointee` instance referenced by `self`.

[`subscript(_:)`](/documentation/Swift/AutoreleasingUnsafeMutablePointer/subscript(_:))

Access the `i`th element of the raw array pointed to by
`self`.

### Comparing Pointers

[`==(_:_:)`](/documentation/Swift/AutoreleasingUnsafeMutablePointer/==(_:_:)-4wfti)

Returns a Boolean value indicating whether two values are equal.



---

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)