Implement bank transfer app flows

This commit is contained in:
2026-06-08 00:03:57 +05:00
parent ef877217ad
commit 9b281d48a7
127 changed files with 8008 additions and 90 deletions
+16 -50
View File
@@ -1,61 +1,27 @@
//
// ContentView.swift
// Thijooree iOS
//
// Created by Mohamed Azim on 6/6/26.
//
import SwiftUI
import SwiftData
struct ContentView: View {
@Environment(\.modelContext) private var modelContext
@Query private var items: [Item]
// Root navigation controller. Switches between top-level app states driven by AppViewModel.route.
struct AppRouter: View {
@Environment(AppViewModel.self) private var appViewModel
var body: some View {
NavigationSplitView {
List {
ForEach(items) { item in
NavigationLink {
Text("Item at \(item.timestamp, format: Date.FormatStyle(date: .numeric, time: .standard))")
} label: {
Text(item.timestamp, format: Date.FormatStyle(date: .numeric, time: .standard))
}
}
.onDelete(perform: deleteItems)
}
.toolbar {
ToolbarItem(placement: .navigationBarTrailing) {
EditButton()
}
ToolbarItem {
Button(action: addItem) {
Label("Add Item", systemImage: "plus")
}
}
}
} detail: {
Text("Select an item")
}
}
private func addItem() {
withAnimation {
let newItem = Item(timestamp: Date())
modelContext.insert(newItem)
}
}
private func deleteItems(offsets: IndexSet) {
withAnimation {
for index in offsets {
modelContext.delete(items[index])
Group {
switch appViewModel.route {
case .onboarding:
OnboardingView()
case .login:
BankSelectionView()
case .lock:
LockScreenView { appViewModel.unlock() }
case .home:
HomeView()
}
}
.animation(.easeInOut(duration: 0.25), value: appViewModel.route)
}
}
#Preview {
ContentView()
.modelContainer(for: Item.self, inMemory: true)
AppRouter()
.environment(AppViewModel())
}