|
In ContentView I have this:
which is passed into the ContentView like this:
Nested inside ContentView is Home, which starts like this:
And then at the bottom of this view I am trying to show a
However, this gives me the error: "Cannot find '$menuState' in scope"; why is this? |
|
The reason is on HWS+ Introduction to Observation but will try to give you quotes
So the main should be this. As you should put into environment at start of app.
or
and
|
|
@NigelGee thanks (as ever!), although I get the error: I had moved:
Into the start of the App (was in ContentView), and that now looks like this:
ContentView does not have any @Environment or @Binding now, and Home (which is nested view inside ContentView) has:
At the top. Previewing Home works as expected, but viewing ContentView gives a Preview crash (the big red cross in the Canvas) Is the something else missing? |
|
SPONSORED Take the pain out of configuring and testing your paywalls. RevenueCat's Paywalls allow you to remotely configure your entire paywall view without any code changes or app updates.
Sponsor Hacking with Swift and reach the world's largest Swift community!
You need to create an account or log in to reply.
All interactions here are governed by our code of conduct.
Link copied to your pasteboard.