Initial commit

This commit is contained in:
2026-06-22 11:28:01 +08:00
commit ace9c94359
84 changed files with 8899 additions and 0 deletions

View File

@ -0,0 +1,38 @@
//
// MainTabsView.swift
// suixinkan
//
// Created by Codex on 2026/6/18.
//
import SwiftUI
/// Tab Tab NavigationStack
struct MainTabsView: View {
@Environment(AppRouter.self) private var appRouter
var body: some View {
@Bindable var appRouter = appRouter
TabView(selection: $appRouter.selectedTab) {
ForEach(AppTab.allCases) { tab in
NavigationStack(path: appRouter.binding(for: tab)) {
tab.rootView
.navigationTitle(tab.title)
.navigationDestination(for: AppRoute.self) { route in
route.destinationView
.toolbar(route.hidesTabBarWhenPushed ? .hidden : .visible, for: .tabBar)
}
}
.environment(appRouter.router(for: tab))
.tabItem { tab.label }
.tag(tab)
}
}
}
}
#Preview {
MainTabsView()
.environment(AppRouter())
}

View File

@ -0,0 +1,77 @@
//
// PlaceholderRootViews.swift
// suixinkan
//
// Created by Codex on 2026/6/18.
//
import SwiftUI
///
struct HomeRootView: View {
var body: some View {
HomeView()
}
}
///
struct OrdersRootView: View {
var body: some View {
PlaceholderTabRootView(title: "订单", systemImage: "doc.text")
}
}
///
struct StatisticsRootView: View {
var body: some View {
PlaceholderTabRootView(title: "数据", systemImage: "chart.bar")
}
}
///
struct ProfileRootView: View {
var body: some View {
ProfileView()
}
}
/// Tab
private struct PlaceholderTabRootView: View {
@Environment(RouterPath.self) private var router
let title: String
let systemImage: String
var body: some View {
VStack(spacing: 16) {
Image(systemName: systemImage)
.font(.system(size: 44, weight: .semibold))
.foregroundStyle(.tint)
Text(title)
.font(.title2.weight(.semibold))
Button {
router.navigate(to: .placeholder(title: "\(title)详情"))
} label: {
Label("打开详情", systemImage: "chevron.right")
}
.buttonStyle(.borderedProminent)
}
.frame(maxWidth: .infinity, maxHeight: .infinity)
.background(Color(.systemGroupedBackground))
}
}
/// Tab NavigationStack
struct PlaceholderDetailView: View {
let title: String
var body: some View {
Text(title)
.font(.title3.weight(.medium))
.frame(maxWidth: .infinity, maxHeight: .infinity)
.background(Color(.systemGroupedBackground))
.navigationTitle(title)
}
}