Hello,
how do I convert an EnvironmentObject to a Binding?
In my GameView have have:
GameView.swift
and my AddPointsView:
But in the GameView.swift I get an error on the (translated) line 6:
how do I convert an EnvironmentObject to a Binding?
In my GameView have have:
GameView.swift
Code Block struct GameView: View { @EnvironmentObject private var game: ObserveableGame var body: some View { ... .sheet(isPresented: $addingPoints) { AddPointsView(game: $game) } } }
and my AddPointsView:
Code Block struct AddPointsView: View { @Binding var game: ObserveableGame var body: some View { ... } }
But in the GameView.swift I get an error on the (translated) line 6:
How do I make a binding to an EnviromentObject?Cannot convert value of type 'EnvironmentObject<ObserveableGame>.Wrapper' to expected argument type 'Binding<ObserveableGame>'