Thursday, May 19, 2022

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 RSS · Twitter

Leave a Comment