New app icon and recipe sharing options (pdf and plain text)

This commit is contained in:
VincentMeilinger
2024-01-10 17:52:34 +01:00
parent 3bcf104a5d
commit d180b96ed8
22 changed files with 288 additions and 7 deletions

View File

@@ -166,6 +166,7 @@ struct MainView: View {
Text("Refresh all")
Image(systemName: "icloud.and.arrow.down")
}
} label: {
Image(systemName: "ellipsis.circle")
}
@@ -235,7 +236,7 @@ struct RecipeSearchView: View {
.navigationDestination(for: Recipe.self) { recipe in
RecipeDetailView(viewModel: viewModel, recipe: recipe)
}
.searchable(text: $searchText, prompt: "Search recipes")
.searchable(text: $searchText, prompt: "Search recipes/keywords")
}
.navigationTitle("Search recipe")
}
@@ -247,7 +248,9 @@ struct RecipeSearchView: View {
func recipesFiltered() -> [Recipe] {
guard searchText != "" else { return allRecipes }
return allRecipes.filter { recipe in
recipe.name.lowercased().contains(searchText.lowercased())
recipe.name.lowercased().contains(searchText.lowercased()) || // check name for occurence of search term
(recipe.keywords != nil && recipe.keywords!.lowercased().contains(searchText.lowercased())) // check keywords for search term
}
}
}