In the previous part, we implemented our custom annotations to our MapView based on our own actual recipe data. Next, we're going to go a step further and add a button to our annotation (called an annotation callout accessory) so that when we click the button, our MapView will dismiss and our ContentView() will filter recipes by that particular country!
First, however, we need to make a little change to how we get recipes from our @EnvironmentObject. Head on over to ContentView.swift and add in the following function to our AppData() class:
func getRecipes(filter: String) -> [RecipeModel] .{ if filter != "" { return recipes.filter ({ $0.origin == filter }) } else { return recipes }}
As ...