Dependencies in struct methods #317
Unanswered
CleverLemming1337
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I'm using this package in my framework where I'm rebuilding SwiftUI for terminals: https://github.com/CleverLemming1337/Interactions
I built a
DependencyWrapper
struct that renders all components with their children applying the environment: https://github.com/CleverLemming1337/Interactions/blob/d418e9d93b11da730c758d6eaf38dff8206a1c7a/Interactions/Environment.swift#L43This is working fine for rendering, but when I want to use the method
activate()
on a component, I only get default values for the dependencies.I know that this is because the DependencyWrapper only passes the environment for rendering.
But I tried many different things and nothing worked because the component to activate is not always the direct child of the DependencyWrapper so I have to pass them not only for rendering but I can't figure out how to do that.
If anyone could help me, I would be really happy. Thank you!
(I know my code is not the best, sorry!)
Beta Was this translation helpful? Give feedback.
All reactions