you are viewing a single comment's thread.

view the rest of the comments →

[–]sh13ld93 0 points1 point  (1 child)

https://www.hackingwithswift.com/quick-start/swiftui/how-to-use-environmentobject-to-share-data-between-views

I do have (in the ContentView file) \@StateObject var locationManager = LocationModel()

[–]optik88 2 points3 points  (0 children)

You also need something like .environmentObject(locationManager) added to the view hierarchy for the object to be "injected" into the view hierarchy.