<!--
{
  "availability" : [
    "iOS: 12.2.0 -",
    "iPadOS: 12.2.0 -",
    "macCatalyst: 12.2.0 -",
    "macOS: 10.14.4 -",
    "tvOS: 12.2.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 5.2.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Swift",
  "identifier" : "/documentation/Swift/UnsafeMutableBufferPointer/mutableSpan",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Property",
  "symbol" : {
    "kind" : "Instance Property",
    "modules" : [
      "Swift"
    ],
    "preciseIdentifier" : "s:SrsRi_zrlE11mutableSpans07MutableB0VyxGvp"
  },
  "title" : "mutableSpan"
}
-->

# mutableSpan

A mutable span over the elements of this buffer.

```
var mutableSpan: MutableSpan<Element> { get }
```

## Return Value

A `MutableSpan` over the elements of this buffer.

## Discussion

The lifetime of the returned span matches the lifetime of the binding
which returns it. This lifetime is a convenience, as there can be no
enforcement that there is no concurrent access to the underlying memory.
The programmer must ensure that the memory remains allocated, initialized
and exclusively accessed for the lifetime of the returned span.

> Note: This property is unsafe because it cannot guarantee that the
> underlying memory remains valid and exclusively accessed for the
> lifetime of the returned span.

> Complexity: O(1)

---

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)