<!--
{
  "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/MutableSpan/extracting(_:)-bphj",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Swift"
    ],
    "preciseIdentifier" : "s:s11MutableSpanVsRi_zrlE10extractingyAByxGSnySiGF"
  },
  "title" : "extracting(_:)"
}
-->

# extracting(_:)

Constructs a new span over the items within the supplied range of
indices within this span.

```
mutating func extracting(_ bounds: Range<MutableSpan<Element>.Index>) -> MutableSpan<Element>
```

## Parameters

`bounds`

A valid range of indices. Every index in
this range must be within the bounds of this `MutableSpan`.

## Return Value

A `MutableSpan` over the items within `bounds`.

## Discussion

The returned span represents a mutation of this span.

The returned span’s first item is always at offset 0; unlike buffer
slices, extracted spans do not share their indices with the
span from which they are extracted.

> 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)