SwiftUI @EnvironmentObject error: may be missing as an ancestor of this view
if you are using sheet ore navigation you have to pass the environment Object maybe its a bug of swiftUI but it works for me in Xcode 11.5:
.sheet(isPresented: $show){
mySheetView().environmentObject(self.myEnviromentObject)
}
The whole issue is very easy to fix just add self.networkManager @ EarthQuakeList.swift
.sheet(isPresented: $showEditPage) {
return EditPage().environmentObject(self.networkManager)
I got the reason and inspired from article: https://github.com/peterfriese/Swift-EnvironmentObject-Demo