# Chapter 21: Using property wrappers

**URL:** <https://forums.kodeco.com/t/chapter-21-using-property-wrappers/206184>\
**Category:** SwiftUI by Tutorials\
**Created:** [September 1, 2024, 11:53pm UTC](https://forums.kodeco.com/t/chapter-21-using-property-wrappers/206184 "2024-09-01T23:53:29Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![tchelyzt](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/tchelyzt/32/111572_2.png) [@tchelyzt](https://forums.kodeco.com/u/tchelyzt)\
**Post date:** [September 1, 2024, 11:53pm UTC](https://forums.kodeco.com/t/chapter-21-using-property-wrappers/206184/1 "2024-09-01T23:53:29Z")

</div>

Hi,

In chapter 21 you say:

> SwiftUI uses property wrappers extensively to let us assign extra functionality to our variables, structs and classes.

I learned to my cost that SwiftUI and property wrappers have unexpected traps.

I have a SwiftUI app that sends some of its work to Metal to take advantage of parallelism. A number of buffers are involved holding arrays of [Int32] and [Float]. It seemed like a good idea to invent a property wrapper to handle all the related buffer stuff (pointers, capacity, stride, loading and recovering data and so on). It worked just fine.

Then I decided I’d compare my fantastic parallel app with a slow old serial version and it turns out it was much slower!!!

The problem seems to be that every refresh of the screen recopies the arrays. [Here’s a page](https://forums.swift.org/t/property-wrapper-causing-excessive-array-copying/30637) that discusses it. (It’s a little over my head).

A massive oversight by Apple I presume.

---

<div class="post-metadata">

**Author:** ![zeny79john](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/zeny79john/32/110937_2.png) [@zeny79john](https://forums.kodeco.com/u/zeny79john)\
**Post date:** [July 9, 2025, 8:12am UTC](https://forums.kodeco.com/t/chapter-21-using-property-wrappers/206184/2 "2025-07-09T08:12:57Z")

</div>

> [@tchelyzt](#):
>
> chapter 21 you say:
> 
> > SwiftUI uses property wrappers extensively to let us assign extra functionality to our variables, structs and classes. [dogsounds](https://www.dogsounds.net)
> 
> I learned to my cost that SwiftUI and property wrappers have unexpected traps.
> 
> I have a SwiftUI app that sends some of its work to Metal to take advantage of parallelism. A number of buffers are involved holding arrays of [Int32] and [Float]. It seemed like a good idea to invent a property wrapper to handle all the related buffer stuff (pointers, capacity, stride, loading and recovering data and so on). It worked just fine.
> 
> Then I decided I’d compare my fantastic parallel app with a slow old serial version and it turns out it was much slower!!!

It sounds like you hit a common, and often frustrating, pitfall: what seems like a good abstraction (a property wrapper for Metal buffers) can sometimes introduce unexpected overhead, especially when you compare it to a simpler, perhaps less “elegant”, serial implementation.
