# Avoiding “Overlapping Access” errors

**URL:** <https://forums.swift.org/t/avoiding-overlapping-access-errors/47320>\
**Category:** Using Swift\
**Tags:** closure\
**Created:** [April 11, 2021, 5:24am UTC](https://forums.swift.org/t/avoiding-overlapping-access-errors/47320 "2021-04-11T05:24:18Z")\
**Posts on this page:** 1\
**Showing post:** 5

<div class="post-metadata">

**Author:** ![JetForMe](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/jetforme/32/482_2.png) [@JetForMe](https://forums.swift.org/u/JetForMe)\
**Post date:** [April 11, 2021, 11:53pm UTC](https://forums.swift.org/t/avoiding-overlapping-access-errors/47320/5 "2021-04-11T23:53:59Z")

</div>

Okay, that clarifies a distinction between `struct` and `class`, thank you. The referenced [post](https://forums.swift.org/t/upgrading-exclusive-access-warning-to-be-an-error-in-swift-4-2/12704) directly addresses my use, although it’s still frustrating that I can’t express what I want.

From the client’s perspective, should `BinaryReader` be a struct or a class? I can make it a struct by passing the reader into the closure as an inout parameter. Doing so encourages me to make my `read` method an extension of `BinaryReader`, which make sense, until you get to `readString()`, which depends on a property of my class. That can be passed in as an argument, but either way it’s messier.

I’m not happy with any solution of these solutions, except maybe making it a class.

---

_[View the full topic](https://forums.swift.org/t/avoiding-overlapping-access-errors/47320)._
