<!--
{
  "availability" : [
    "iOS: 27.0.0 -",
    "iPadOS: 27.0.0 -",
    "macCatalyst: 27.0.0 -",
    "macOS: 27.0.0 -",
    "tvOS: 27.0.0 -",
    "visionOS: 27.0.0 -",
    "watchOS: 27.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Swift",
  "identifier" : "/documentation/Swift/MutableRef",
  "metadataVersion" : "0.1.0",
  "role" : "Structure",
  "symbol" : {
    "kind" : "Structure",
    "modules" : [
      "Swift"
    ],
    "preciseIdentifier" : "s:s10MutableRefV"
  },
  "title" : "MutableRef"
}
-->

# MutableRef

A safe mutable reference allowing in-place mutation to an exclusive value.

```
@frozen struct MutableRef<Value> where Value : ~Copyable
```

## Topics

### Initializers

[`init(inout Value)`](/documentation/Swift/MutableRef/init(_:))

Initializes an instance of `MutableRef` with the given mutable value. This
creates a mutable reference to that value preventing writes to the
original value while this mutable reference is still active.

[`init<Owner>(unsafeAddress: UnsafeMutablePointer<Value>, mutating: inout Owner)`](/documentation/Swift/MutableRef/init(unsafeAddress:mutating:))

Unsafely initializes an instance of `MutableRef` using the given
‘unsafeAddress’ as the mutable reference based on the mutating lifetime of
the given ‘owner’ argument.

### Instance Properties

[`var value: Value`](/documentation/Swift/MutableRef/value)

Dereferences the mutable reference allowing for in-place reads and writes
to the underlying value.

## Relationships

### Conforms To

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

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

---

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)