Custom propertyWrapper in State: Compiler error when using new @ObservableState macro #2862
mschonvogel
started this conversation in
General
Replies: 2 comments 1 reply
-
Hi @mschonvogel, this is just a problem with Swift macros in general. It won't work with Swift's @Observable
class Foo { var count = 0 } // 🛑
@Model
class Bar { var count = 0 } // 🛑 Since this is not an issue with the library I am going to convert it to a discussion. |
Beta Was this translation helpful? Give feedback.
0 replies
-
I’ve not come across this gotcha yet as I haven’t started using observable state, but does this mean in general property wrappers cannot be used in state structs? We have a @Loadable property wrapper that we use everywhere and this is going to be a big blocker for us. Is there a workaround? |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Description
When using a
propertyWrapper
in the state in combination with the@ObservableState
macro, it causes a compiler error:Here's a reproducible project: TCAState PropertyWrapper.zip
Here's an example
propertyWrapper
:State:
Checklist
main
branch of this package.Expected behavior
The project should compile successfully (as prior to updating to the
@ObservableState
macro)Actual behavior
Error while compiling
Steps to reproduce
No response
The Composable Architecture version information
1.8.2
Destination operating system
iOS 17
Xcode version information
15.2
Swift Compiler version information
Beta Was this translation helpful? Give feedback.
All reactions