Files
scan-receipts/app/ios/ScanReceipts/App/RootView.swift

39 lines
1.2 KiB
Swift

import SwiftUI
/// Top-level router: which screen the user sees is entirely a function of
/// `AppState.phase`. Nothing else in the app should make navigation
/// decisions based on auth state route through here instead.
struct RootView: View {
@EnvironmentObject private var appState: AppState
var body: some View {
Group {
switch appState.phase {
case .checking:
LaunchView()
case .signedOut:
// Provided by Features/Auth/AuthFlowView.swift
AuthFlowView()
case .signedIn:
// Provided by Features/Root/MainTabView.swift
MainTabView()
}
}
.animation(.default, value: appState.phase)
}
}
private struct LaunchView: View {
var body: some View {
VStack(spacing: ZenithSpacing.xs) {
Image(systemName: "doc.text.viewfinder")
.font(.system(size: 44))
.foregroundStyle(.zenithBlack)
ProgressView()
.tint(.zenithBlack)
}
.frame(maxWidth: .infinity, maxHeight: .infinity)
.background(Color.zenithBg)
}
}