Files
suixinkan_ios_new/suixinkan/App/Navigation/AppTab.swift
汉秋 8997d1ba1c 集成 MJRefresh 并重构主 TabBar 为系统 TabView 样式。
新增 SwiftUI 桥接层与单元测试,更新 Tab 图标资源命名和多倍图,同步调整 UI Test 的 Tab/扫码定位逻辑。

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-29 10:22:53 +08:00

92 lines
1.9 KiB
Swift
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

//
// AppTab.swift
// suixinkan
//
// Created by Codex on 2026/6/18.
//
import SwiftUI
/// Tab
enum AppTab: String, CaseIterable, Identifiable, Hashable {
case home
case orders
case statistics
case profile
var id: Self { self }
var title: String {
switch self {
case .home:
"首页"
case .orders:
"订单"
case .statistics:
"数据"
case .profile:
"我的"
}
}
var systemImage: String {
switch self {
case .home:
"house"
case .orders:
"doc.text"
case .statistics:
"chart.bar"
case .profile:
"person"
}
}
/// Tab 使
var selectedImageName: String {
switch self {
case .home:
"tab_home_selected"
case .orders:
"tab_order_selected"
case .statistics:
"tab_data_selected"
case .profile:
"tab_profile_selected"
}
}
/// Tab 使
var unselectedImageName: String {
switch self {
case .home:
"tab_home_unselected"
case .orders:
"tab_order_unselected"
case .statistics:
"tab_data_unselected"
case .profile:
"tab_profile_unselected"
}
}
@ViewBuilder
var rootView: some View {
switch self {
case .home:
HomeRootView()
case .orders:
OrdersRootView()
case .statistics:
StatisticsRootView()
case .profile:
ProfileRootView()
}
}
@ViewBuilder
var label: some View {
Label(title, systemImage: systemImage)
}
}