# \#span

**URL:** https://forums.swift.org/tag/span/1114.md

[Latest](https://forums.swift.org/latest.md) · [Categories](https://forums.swift.org/categories.md) · [Tags](https://forums.swift.org/tags.md)

---

## [Understanding Iterable and Span's Escapable requirement](https://forums.swift.org/t/understanding-iterable-and-spans-escapable-requirement/90530)

<div class="topic-metadata">

**Author:** [@mattie](https://forums.swift.org/u/mattie)\
**Replies:** 2\
**Last updated:** [November 6, 2026, 4:16pm UTC](https://forums.swift.org/t/understanding-iterable-and-spans-escapable-requirement/90530 "2026-11-06T16:16:02Z")

</div>

I've been experimenting with the new Iterable protocol in combination with some other explorations around ~Escapable types. I ran into something that surprised me. I suspect this is just because I'm very new to these con…

---

## [\[Pitch\] Add RawSpan primitive to Hasher](https://forums.swift.org/t/pitch-add-rawspan-primitive-to-hasher/89583)

<div class="topic-metadata">

**Author:** [@jmschonfeld](https://forums.swift.org/u/jmschonfeld)\
**Replies:** 3\
**Last updated:** [October 12, 2026, 11:12pm UTC](https://forums.swift.org/t/pitch-add-rawspan-primitive-to-hasher/89583 "2026-10-12T23:12:26Z")

</div>

Hi everyone, I have a short pitch to add a RawSpan primitive to Hasher to mirror the existing unsafe buffer pointer API. The swift-evolution PR is up at Add RawSpan primitive to Hasher by jmschonfeld · Pull Request #3490…

---

## [Future of ~Escapable for Slices](https://forums.swift.org/t/future-of-escapable-for-slices/89800)

<div class="topic-metadata">

**Author:** [@Dmitriy\_Ignatyev](https://forums.swift.org/u/Dmitriy_Ignatyev)\
**Replies:** 3\
**Last updated:** [October 2, 2026, 4:46pm UTC](https://forums.swift.org/t/future-of-escapable-for-slices/89800 "2026-10-02T16:46:18Z")

</div>

Hi everyone With the recent advancements in Swift’s ownership model, specifically the introduction of ~Escapable types, we now have a robust system for compile-time lifetime control. This got me thinking about the seman…

---

## [How can I implement a {mutable}span property for my inline storage type?](https://forums.swift.org/t/how-can-i-implement-a-mutable-span-property-for-my-inline-storage-type/89499)

<div class="topic-metadata">

**Author:** [@atifdev10](https://forums.swift.org/u/atifdev10)\
**Replies:** 4\
**Last updated:** [September 12, 2026, 1:23pm UTC](https://forums.swift.org/t/how-can-i-implement-a-mutable-span-property-for-my-inline-storage-type/89499 "2026-09-12T13:23:07Z")

</div>

Currently, the platforms I'm targeting, do not support InlineArray. So, I wrote a simple type that stores some values inline: // Simplified, there are normally some other stuff here. struct InlineArraySize4\<T\> { var…

---

## [What happened to \`Data(rawCapacity:)\` initializer?](https://forums.swift.org/t/what-happened-to-data-rawcapacity-initializer/83156)

<div class="topic-metadata">

**Author:** [@craigwrong](https://forums.swift.org/u/craigwrong)\
**Replies:** 5\
**Last updated:** [August 31, 2026, 5:02pm UTC](https://forums.swift.org/t/what-happened-to-data-rawcapacity-initializer/83156 "2026-08-31T17:02:57Z")

</div>

Greetings! Trying to understand how to work with output spans. I noticed this WWDC session showcases the use of: let pixelData = Data(rawCapacity: totalBytes) { outputSpan in Which does not seem to exist in Foundatio…

---

## [Swift-span-algorithms — allocation-free algorithms over Span / RawSpan](https://forums.swift.org/t/swift-span-algorithms-allocation-free-algorithms-over-span-rawspan/88542)

<div class="topic-metadata">

**Author:** [@Dave861](https://forums.swift.org/u/Dave861)\
**Replies:** 0\
**Last updated:** [July 26, 2026, 5:37am UTC](https://forums.swift.org/t/swift-span-algorithms-allocation-free-algorithms-over-span-rawspan/88542 "2026-07-26T05:37:16Z")

</div>

Repo: Dave861/swift-span-algorithms SPI Releases: swiftpackageindex.com/Dave861/swift-span-algorithms Zero dependencies, Apache-2.0, macOS 13 deployment floor for the Span/RawSpan surface, 181 tests. Why Span is ~Esca…

---

## [\[Pitch\] Data Manipulation with Spans](https://forums.swift.org/t/pitch-data-manipulation-with-spans/87952)

<div class="topic-metadata">

**Author:** [@jmschonfeld](https://forums.swift.org/u/jmschonfeld)\
**Replies:** 3\
**Last updated:** [July 6, 2026, 11:28pm UTC](https://forums.swift.org/t/pitch-data-manipulation-with-spans/87952 "2026-07-06T23:28:05Z")

</div>

Hi Swift community! I have a a new pitch for adding APIs to Data that mirror those of the new UniqueArray type that allow for manipulating its contents via the various span types (as opposed to generic Collections or un…

---

## [How to convert \`RawSpan\` to \`Span\<UInt8\>\`?](https://forums.swift.org/t/how-to-convert-rawspan-to-span-uint8/85993)

<div class="topic-metadata">

**Author:** [@snej](https://forums.swift.org/u/snej)\
**Replies:** 1\
**Last updated:** [April 13, 2026, 5:17pm UTC](https://forums.swift.org/t/how-to-convert-rawspan-to-span-uint8/85993 "2026-04-13T17:17:02Z")

</div>

Until SE-525 lands, is there any way at all (in Swift 6.3) to convert a RawSpan to a Span\<UInt8\>? I’m struggling and failing. Even the BinaryParsing package doesn’t offer a way to get a typed Span from its ParserSpan. T…

---

## [Is it safe to keep a span alive and use its pointer across a suspension?](https://forums.swift.org/t/is-it-safe-to-keep-a-span-alive-and-use-its-pointer-across-a-suspension/85382)

<div class="topic-metadata">

**Author:** [@orobio](https://forums.swift.org/u/orobio)\
**Replies:** 4\
**Last updated:** [March 18, 2026, 11:25am UTC](https://forums.swift.org/t/is-it-safe-to-keep-a-span-alive-and-use-its-pointer-across-a-suspension/85382 "2026-03-18T11:25:09Z")

</div>

What I'm doing is the following: func write(\_ span: Span\<UInt8\>) async { let spanBufferPointer = span.withUnsafeBytes { $0 } // Get the pointer. Usually a bad pattern. defer { extendLifetime(span) } // Pointer m…

---

## [Pitch: Add \`withTemporaryAllocation\` using \`Output(Raw)Span\`](https://forums.swift.org/t/pitch-add-withtemporaryallocation-using-output-raw-span/84923)

<div class="topic-metadata">

**Author:** [@Max\_Desiatov](https://forums.swift.org/u/Max_Desiatov)\
**Replies:** 12\
**Last updated:** [February 25, 2026, 8:58am UTC](https://forums.swift.org/t/pitch-add-withtemporaryallocation-using-output-raw-span/84923 "2026-02-25T08:58:48Z")

</div>

Hello, Swift community! I'd like to pitch a few small additions to the standard library that you'd be interested in. One notable part is that these proposed withTemporaryAllocation functions can be back-deployed, which …

---

## [Difficulty using MutableSpan](https://forums.swift.org/t/difficulty-using-mutablespan/84491)

<div class="topic-metadata">

**Author:** [@ksluder](https://forums.swift.org/u/ksluder)\
**Replies:** 4\
**Last updated:** [January 31, 2026, 5:32pm UTC](https://forums.swift.org/t/difficulty-using-mutablespan/84491 "2026-01-31T17:32:23Z")

</div>

I’m trying to use MutableSpan in a project for the first time. I’m having difficulty with a couple things: Is it intentional that there’s no UnsafeMutableRawBufferPointer.mutableSpan? I expected such a property to exi…

---

## [Better C interoperability e.g. with apinotes](https://forums.swift.org/t/better-c-interoperability-e-g-with-apinotes/84474)

<div class="topic-metadata">

**Author:** [@Sajjon](https://forums.swift.org/u/Sajjon)\
**Replies:** 8\
**Last updated:** [January 31, 2026, 7:55am UTC](https://forums.swift.org/t/better-c-interoperability-e-g-with-apinotes/84474 "2026-01-31T07:55:06Z")

</div>

I'm following @Douglas\_Gregor s excellent guide Improving the usability of C libraries in Swift | Swift.org to improve how I interop with libsecp256k1 in my K1 (non-trivial Swift wrapper around libsecp256k1 with API's li…

---

## [Possible unsoundness with RawSpan and MutableRawSpan](https://forums.swift.org/t/possible-unsoundness-with-rawspan-and-mutablerawspan/83980)

<div class="topic-metadata">

**Author:** [@ellie20](https://forums.swift.org/u/ellie20)\
**Replies:** 11\
**Last updated:** [January 16, 2026, 12:25am UTC](https://forums.swift.org/t/possible-unsoundness-with-rawspan-and-mutablerawspan/83980 "2026-01-16T00:25:13Z")

</div>

The RawSpan and MutableRawSpan APIs make it possible to arbitrarily change the bit pattern of a BitwiseCopyable value without using unsafe code. For example, the following function returns a Bool value with an invalid bi…

---

## [\`exclusive\` parameter ownership modifier](https://forums.swift.org/t/exclusive-parameter-ownership-modifier/83503)

<div class="topic-metadata">

**Author:** [@John\_McCall](https://forums.swift.org/u/John_McCall)\
**Replies:** 27\
**Last updated:** [December 29, 2025, 11:17pm UTC](https://forums.swift.org/t/exclusive-parameter-ownership-modifier/83503 "2025-12-29T23:17:16Z")

</div>

Introduction mutating methods require the caller to ensure that the location passed as self can only be accessed through self. This guarantee of exclusive access is a very strong property that can be used by carefully wr…

---

## [C annotations \`counted\_by\` and \`noescape\` not producing Span consuming function signatures](https://forums.swift.org/t/c-annotations-counted-by-and-noescape-not-producing-span-consuming-function-signatures/83333)

<div class="topic-metadata">

**Author:** [@craigwrong](https://forums.swift.org/u/craigwrong)\
**Replies:** 3\
**Last updated:** [November 21, 2025, 3:42pm UTC](https://forums.swift.org/t/c-annotations-counted-by-and-noescape-not-producing-span-consuming-function-signatures/83333 "2025-11-21T15:42:35Z")

</div>

Hello again :waving\_hand: I’m trying to introduce memory safety to my Swift project which integrates some C functions. For this I referred to this WWDC session Unfortunately the \_\_noescape annotation is not being recog…

---

## [State of Span/RawSpan](https://forums.swift.org/t/state-of-span-rawspan/81233)

<div class="topic-metadata">

**Author:** [@FlorianPircher](https://forums.swift.org/u/FlorianPircher)\
**Replies:** 2\
**Last updated:** [July 21, 2025, 5:11pm UTC](https://forums.swift.org/t/state-of-span-rawspan/81233 "2025-07-21T17:11:23Z")

</div>

I would like to experiment with the new RawSpan type, particularly for embedded Swift. In this year’s WWDC session 312 by @nnnnnnnn, the following code is shown: extension RawSpan { mutating func readByte() -\> UInt8? {…
