
- 新增设置功能模块,包含用户信息管理和设置选项。 - 实现动态视图,展示用户动态内容。 - 更新HomeView以支持设置页面的展示和动态视图的切换。 - 添加底部导航栏,增强用户体验。 - 更新相关视图和组件,确保一致的UI风格和交互体验。
74 lines
1.8 KiB
Swift
74 lines
1.8 KiB
Swift
import SwiftUI
|
|
|
|
// MARK: - Tab 枚举
|
|
enum Tab: Int, CaseIterable {
|
|
case feed = 0
|
|
case me = 1
|
|
|
|
var title: String {
|
|
switch self {
|
|
case .feed:
|
|
return "动态"
|
|
case .me:
|
|
return "我的"
|
|
}
|
|
}
|
|
|
|
var iconName: String {
|
|
switch self {
|
|
case .feed:
|
|
return "sparkles"
|
|
case .me:
|
|
return "person"
|
|
}
|
|
}
|
|
|
|
var selectedIconName: String {
|
|
switch self {
|
|
case .feed:
|
|
return "sparkles"
|
|
case .me:
|
|
return "person.fill"
|
|
}
|
|
}
|
|
}
|
|
|
|
// MARK: - BottomTabView 组件
|
|
struct BottomTabView: View {
|
|
@Binding var selectedTab: Tab
|
|
|
|
var body: some View {
|
|
HStack(spacing: 0) {
|
|
ForEach(Tab.allCases, id: \.rawValue) { tab in
|
|
Button(action: {
|
|
selectedTab = tab
|
|
}) {
|
|
VStack(spacing: 4) {
|
|
Image(systemName: selectedTab == tab ? tab.selectedIconName : tab.iconName)
|
|
.font(.system(size: 20))
|
|
.foregroundColor(selectedTab == tab ? .purple : .gray)
|
|
|
|
Text(tab.title)
|
|
.font(.caption2)
|
|
.foregroundColor(selectedTab == tab ? .purple : .gray)
|
|
}
|
|
.frame(maxWidth: .infinity)
|
|
}
|
|
.buttonStyle(PlainButtonStyle())
|
|
}
|
|
}
|
|
.padding(.vertical, 12)
|
|
.padding(.horizontal, 8)
|
|
.background(
|
|
.ultraThinMaterial,
|
|
in: Rectangle()
|
|
)
|
|
.overlay(
|
|
Rectangle()
|
|
.frame(height: 0.5)
|
|
.foregroundColor(.black.opacity(0.2)),
|
|
alignment: .top
|
|
)
|
|
}
|
|
}
|