Dependency Entry macro to mimic Environment Entry #258
Replies: 2 comments 2 replies
-
Hi @DominikGrodl, thanks for taking the time to explore this! The ![]() I think in order for a If you want to explore that then we'd be interested to see what you find. |
Beta Was this translation helpful? Give feedback.
-
I'm not too familiar with writing macros. Is it possible add optional parameters to them? Something like:
And if those values are omitted, it would behave as if you did not include a test or preview value. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
A recent message on PointFree Slack made me think whether we could utilize a macro similar to the newly added Entry macro for registering Environment values in SwiftUI. I tried to sketch what that could look like here. Please keep in mind this is a piece of code for a quick demonstration purpose. I would love to make it more stable and polished (such as add tests) if we decide to go forward with this proposal.
This macro does not eliminate a lot of boilerplate, actually almost none, when looked at from the perspective of one dependency, but does help when emitting a large number of dependencies.
Beta Was this translation helpful? Give feedback.
All reactions