import SwiftUI struct RootView: View { @EnvironmentObject var appState: AppState var body: some View { TabView(selection: $appState.selectedTab) { ScanScreen() .tabItem { Label(AppState.Tab.scan.title, systemImage: AppState.Tab.scan.icon) } .tag(AppState.Tab.scan) FavoritesScreen() .tabItem { Label(AppState.Tab.favorites.title, systemImage: AppState.Tab.favorites.icon) } .tag(AppState.Tab.favorites) HistoryScreen() .tabItem { Label(AppState.Tab.history.title, systemImage: AppState.Tab.history.icon) } .tag(AppState.Tab.history) AccountScreen() .tabItem { Label(AppState.Tab.account.title, systemImage: AppState.Tab.account.icon) } .tag(AppState.Tab.account) } .tint(.green) .sheet(isPresented: $appState.showLoginSheet) { LoginSheet() .environmentObject(appState) } .sheet(isPresented: $appState.showRegisterSheet) { RegisterSheet() .environmentObject(appState) } .overlay { if let error = appState.errorMessage { VStack { Spacer() Text(error) .font(.subheadline) .foregroundColor(.white) .padding() .background(Color.red.opacity(0.9)) .cornerRadius(10) .padding(.bottom, 100) } .transition(.move(edge: .bottom).combined(with: .opacity)) .animation(.easeInOut, value: appState.errorMessage) } } } }