Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EnvironmentObject help #88

Closed
Tyler-Keith-Thompson opened this issue Mar 1, 2021 · 2 comments
Closed

EnvironmentObject help #88

Tyler-Keith-Thompson opened this issue Mar 1, 2021 · 2 comments

Comments

@Tyler-Keith-Thompson
Copy link
Contributor

Sorry for the multiple issues opened at once, but this one has been a head-scratcher for me. So if you've got views that nest views using environment objects the ViewHosting.host(view.environmentObject(object)) trick doesn't work. Any nested view that also requires environment objects doesn't get it.

I have a feeling (after trying to dive into this) that you're just limited by what Apple allows for, it may just be a documentation update. However as a relatively new user of the library (and somebody new to SwiftUI) I was baffled for a bit why environment objects weren't affecting...well...the whole environment.

@nalexn
Copy link
Owner

nalexn commented Mar 1, 2021

Hey, yes, this is a known #62 issue, sorry about that. You're right, environment object isn't automatically injected into the whole hierarchy, SwiftUI seems to be doing it individually for every view. I do have a couple of ideas for how to work around this limitation, in the meanwhile, I recommend testing such custom views separately.

@Tyler-Keith-Thompson
Copy link
Contributor Author

Gotcha, I'll close this since it's a duplicate issue. Thanks for the quick response.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants