Environment Object Search Selection
Maps UIKit SwiftUI
With the ability to search for items in our SearchLocationView, we are now ready to handle the selection of objects from the list. This can be done in many ways but using an EnvironmentObject makes it super simple as you can control variables from deeply nested child views.

Comments (2)
Vlad
3 years ago
Really useful lesson on Environment Objects. Thanks a lot Brian!
astericky
3 years ago
I really liked this lesson Brain! Thanks. EnviornmentObject is equivalent to a react context or a redux in my mind.
astericky
3 years ago
One question: Why did you introduce the ternary at the end? Isn't it equivalent to the nil coalescing just by itself?
shivaskanthan
3 years ago
Yes it is. This is what I did and it works well. Text(env.destinationMapItem?.name ?? "Destination")
HELP & SUPPORT