<!--
{
  "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/Span",
  "metadataVersion" : "0.1.0",
  "role" : "Structure",
  "symbol" : {
    "kind" : "Structure",
    "modules" : [
      "Swift"
    ],
    "preciseIdentifier" : "s:s4SpanV"
  },
  "title" : "Span"
}
-->

# Span

`Span<Element>` represents a contiguous region of memory
which contains initialized instances of `Element`.

```
@frozen struct Span<Element> where Element : ~Copyable
```

## Overview

A `Span` instance is a non-owning, non-escaping view into memory.
When a `Span` is created, it inherits the lifetime of the container
owning the contiguous memory, ensuring temporal safety and avoiding
use-after-free errors. Operations on `Span` are bounds-checked,
ensuring spatial safety and avoiding buffer overflow errors.

## Relationships

### Conforms To

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

[`ContiguousBytes`](/documentation/Foundation/ContiguousBytes)

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

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

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

---

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)