Post

Replies

Boosts

Views

Activity

EnvironmentObject to Binding
Hello, how do I convert an EnvironmentObject to a Binding? In my GameView have have: GameView.swift struct GameView: View { @EnvironmentObject private var game: ObserveableGame var body: some View { 	... 	.sheet(isPresented: $addingPoints) { 	 AddPointsView(game: $game) } } } and my AddPointsView: 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: Cannot convert value of type 'EnvironmentObject<ObserveableGame>.Wrapper' to expected argument type 'Binding<ObserveableGame>' How do I make a binding to an EnviromentObject?
1
0
4.2k
Jun ’20