Files
Gas-Tank-AR-App/GasTankAR/ContentView.swift

34 lines
1.0 KiB
Swift

import SwiftUI
struct ContentView: View {
// Composition root: the server stubs are replaced here when APIs are available.
private let loginUseCase: any LoginUseCase = DefaultLoginUseCase(
authenticationService: StubAuthenticationService()
)
@State private var leadService = StubLeadRemoteService(listDelay: .milliseconds(800))
@State private var detailRepository = DefaultLeadDetailRepository(remoteService: StubLeadDetailRemoteService())
@State private var session: LoginSession?
var body: some View {
if let session {
NavigationStack {
LeadOverviewView(
session: session,
repository: DefaultLeadRepository(remoteService: leadService),
detailRepository: detailRepository
) {
self.session = nil
}
}
} else {
LoginView(loginUseCase: loginUseCase) {
session = $0
}
}
}
}
#Preview {
ContentView()
}