# \#borrowing

**URL:** https://forums.swift.org/tag/borrowing/1007.md

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

---

## [Escapable parameters to non-escapable initializer](https://forums.swift.org/t/escapable-parameters-to-non-escapable-initializer/90504)

<div class="topic-metadata">

**Author:** [@mattie](https://forums.swift.org/u/mattie)\
**Replies:** 3\
**Last updated:** [November 6, 2026, 2:49am UTC](https://forums.swift.org/t/escapable-parameters-to-non-escapable-initializer/90504 "2026-11-06T02:49:59Z")

</div>

I've been trying to get my head around @\_lifetime and ~Escapable. I'm making progress, but I encountered something that has me stumped. Here's the code in question: struct Restricted: ~Escapable { // error: Cannot bor…

---

## [Borrowed value with \`as\` casting](https://forums.swift.org/t/borrowed-value-with-as-casting/88236)

<div class="topic-metadata">

**Author:** [@UniverseObserver](https://forums.swift.org/u/UniverseObserver)\
**Replies:** 4\
**Last updated:** [July 23, 2026, 2:12pm UTC](https://forums.swift.org/t/borrowed-value-with-as-casting/88236 "2026-07-23T14:12:30Z")

</div>

Hi, I'm a mentee participating in the Swift Mentorship program. I have interest in the ownership system but I'm fairly new to the compiler implementation. I am picking up issue Compiler crash: \`borrowing\` parameter in a…

---

## [Limitations of \`borrowing\` / why not first-class borrowed references?](https://forums.swift.org/t/limitations-of-borrowing-why-not-first-class-borrowed-references/80025)

<div class="topic-metadata">

**Author:** [@KeithBauerANZ](https://forums.swift.org/u/KeithBauerANZ)\
**Replies:** 4\
**Last updated:** [February 4, 2026, 9:19pm UTC](https://forums.swift.org/t/limitations-of-borrowing-why-not-first-class-borrowed-references/80025 "2026-02-04T21:19:10Z")

</div>

struct Noncopyable: ~Copyable {} func doSomething(\_ n: borrowing Noncopyable? = nil) {} let n = Noncopyable() doSomething(n) // error: implicit conversion to 'Noncopyable?' is consuming Yeah, makes sense. I understand…

---

## [Borrowing still creates a copy of the method parameter?!](https://forums.swift.org/t/borrowing-still-creates-a-copy-of-the-method-parameter/82291)

<div class="topic-metadata">

**Author:** [@winstondu](https://forums.swift.org/u/winstondu)\
**Replies:** 10\
**Last updated:** [September 22, 2025, 11:55pm UTC](https://forums.swift.org/t/borrowing-still-creates-a-copy-of-the-method-parameter/82291 "2025-09-22T23:55:31Z")

</div>

I’m trying to build an intuition for the parameter ownership modifiers—specifically borrowing—as described in SE-0377. My mental model (possibly wrong!) is that a borrowing parameter gives the callee temporary, read-only…

---

## [Is it possible to capture a \`borrowing\` parameter in a non-escaping closure?](https://forums.swift.org/t/is-it-possible-to-capture-a-borrowing-parameter-in-a-non-escaping-closure/72967)

<div class="topic-metadata">

**Author:** [@Karl](https://forums.swift.org/u/Karl)\
**Replies:** 4\
**Last updated:** [August 20, 2025, 3:51pm UTC](https://forums.swift.org/t/is-it-possible-to-capture-a-borrowing-parameter-in-a-non-escaping-closure/72967 "2025-08-20T15:51:02Z")

</div>

I'm trying to do something like this: struct Foo { @inlinable public init( \_ source: borrowing some RandomAccessCollection\<Int\> ) { \_withUnprotectedUnsafeTemporaryAllocation( of: Int.self, capacity:…

---

## [Borrowing: Works with struct but fails with tuple](https://forums.swift.org/t/borrowing-works-with-struct-but-fails-with-tuple/81444)

<div class="topic-metadata">

**Author:** [@saulpalv](https://forums.swift.org/u/saulpalv)\
**Replies:** 3\
**Last updated:** [August 3, 2025, 11:34am UTC](https://forums.swift.org/t/borrowing-works-with-struct-but-fails-with-tuple/81444 "2025-08-03T11:34:17Z")

</div>

I have a code that has same data in two forms Tuple and Struct, they are both tested by converting to the same Final Struct, however the code only compiles for the struct whereas fails for the tuple, is there something f…

---

## [Borrowing nested withUnsafePointer: cannot be captured by an escaping closure since it is a borrowed parameter](https://forums.swift.org/t/borrowing-nested-withunsafepointer-cannot-be-captured-by-an-escaping-closure-since-it-is-a-borrowed-parameter/80210)

<div class="topic-metadata">

**Author:** [@saulpalv](https://forums.swift.org/u/saulpalv)\
**Replies:** 8\
**Last updated:** [July 21, 2025, 4:21am UTC](https://forums.swift.org/t/borrowing-nested-withunsafepointer-cannot-be-captured-by-an-escaping-closure-since-it-is-a-borrowed-parameter/80210 "2025-07-21T04:21:03Z")

</div>

have two borrowed parameters of type SDL\_FRect, need to convert both to UnsafePointer\<SDL\_FRect\>, but nested closures and borrowing parameters do not like each other func drawTexture( \_ texture: SDLTexture, …

---

## [Doesn't Swift borrow immutable structs by default?](https://forums.swift.org/t/doesnt-swift-borrow-immutable-structs-by-default/75595)

<div class="topic-metadata">

**Author:** [@isaac-weisberg](https://forums.swift.org/u/isaac-weisberg)\
**Replies:** 7\
**Last updated:** [January 6, 2025, 1:27pm UTC](https://forums.swift.org/t/doesnt-swift-borrow-immutable-structs-by-default/75595 "2025-01-06T13:27:42Z")

</div>

I have just found out that you can pass Copyable structs into a function that declares the parameter as borrowing. Which is pretty cool, optimizations and stuff.. However: struct is a value type and we are taught that…

---

## [\`borrowing\` + \`sending\` not allowed?](https://forums.swift.org/t/borrowing-sending-not-allowed/74711)

<div class="topic-metadata">

**Author:** [@vns](https://forums.swift.org/u/vns)\
**Replies:** 1\
**Last updated:** [September 18, 2024, 9:54pm UTC](https://forums.swift.org/t/borrowing-sending-not-allowed/74711 "2024-09-18T21:54:36Z")

</div>

I've been playing with some ways to work together with sending and ownership, and stumbled across case I'm not sure how to treat: class NonSendable { } func foo(bar: borrowing sending NonSendable) { // error: 'sending…

---

## [Do \`borrowing\` parameters cause extra pointers?](https://forums.swift.org/t/do-borrowing-parameters-cause-extra-pointers/72040)

<div class="topic-metadata">

**Author:** [@wadetregaskis](https://forums.swift.org/u/wadetregaskis)\
**Replies:** 3\
**Last updated:** [May 23, 2024, 10:33pm UTC](https://forums.swift.org/t/do-borrowing-parameters-cause-extra-pointers/72040 "2024-05-23T22:33:02Z")

</div>

I've heard borrowing parameters described as const T& or const T\* as analogies to C/C++. I'm trying to understand which it actual is, or more to the point when an extra pointer might get involved, that wouldn't be there…
