Thursday, May 19, 2022 [Tweets] [Favorites]

Indirect Struct Properties in Swift

Sean Heber:

Surprised that Swift has “indirect” for enum cases but not for structs. Seems like a weird omission.

Here’s a property wrapper that lets you use “indirect” properties in a struct for those times when you really want to because “reasons.”

It uses an enum wrapper, which is more efficient than an object.

Comments

Stay up-to-date by subscribing to the Comments RSS Feed for this post.

Leave a Comment