WIP - Complete App refactoring

This commit is contained in:
VincentMeilinger
2025-05-26 15:52:24 +02:00
parent 29fd3c668b
commit 5acf3b9c4f
49 changed files with 1996 additions and 543 deletions

View File

@@ -7,7 +7,7 @@
import Foundation
import SwiftUI
/*
struct SearchTabView: View {
@EnvironmentObject var viewModel: SearchTabView.ViewModel
@EnvironmentObject var appState: AppState
@@ -30,7 +30,7 @@ struct SearchTabView: View {
.listRowSeparatorTint(.clear)
}
.listStyle(.plain)
.navigationDestination(for: Recipe.self) { recipe in
.navigationDestination(for: CookbookApiRecipeV1.self) { recipe in
RecipeView(viewModel: RecipeView.ViewModel(recipe: recipe))
}
.searchable(text: $viewModel.searchText, prompt: "Search recipes/keywords")
@@ -48,7 +48,7 @@ struct SearchTabView: View {
}
class ViewModel: ObservableObject {
@Published var allRecipes: [Recipe] = []
@Published var allRecipes: [CookbookApiRecipeV1] = []
@Published var searchText: String = ""
@Published var searchMode: SearchMode = .name
@@ -58,7 +58,7 @@ struct SearchTabView: View {
case name = "Name & Keywords", ingredient = "Ingredients"
}
func recipesFiltered() -> [Recipe] {
func recipesFiltered() -> [CookbookApiRecipeV1] {
if searchMode == .name {
guard searchText != "" else { return allRecipes }
return allRecipes.filter { recipe in
@@ -72,3 +72,4 @@ struct SearchTabView: View {
}
}
}
*/