
- 在Podfile中添加Alamofire依赖,并更新Podfile.lock以反映更改。 - 新增动态内容API文档,详细描述`dynamic/square/latestDynamics`接口的请求参数、响应数据结构及示例。 - 实现动态内容的模型和API请求结构,支持获取最新动态列表。 - 更新FeedView和HomeView以集成动态内容展示,增强用户体验。 - 添加动态卡片组件,展示用户动态信息及互动功能。
68 lines
2.2 KiB
Swift
68 lines
2.2 KiB
Swift
import SwiftUI
|
|
import ComposableArchitecture
|
|
|
|
struct HomeView: View {
|
|
let store: StoreOf<HomeFeature>
|
|
@ObservedObject private var localizationManager = LocalizationManager.shared
|
|
@State private var selectedTab: Tab = .feed
|
|
|
|
var body: some View {
|
|
WithPerceptionTracking {
|
|
GeometryReader { geometry in
|
|
ZStack {
|
|
// 使用 "bg" 图片作为背景 - 全屏显示
|
|
Image("bg")
|
|
.resizable()
|
|
.aspectRatio(contentMode: .fill)
|
|
.frame(maxWidth: .infinity, maxHeight: .infinity)
|
|
.clipped()
|
|
.ignoresSafeArea(.all)
|
|
|
|
// 主要内容区域 - 全屏显示
|
|
ZStack {
|
|
switch selectedTab {
|
|
case .feed:
|
|
FeedView(
|
|
store: Store(initialState: FeedFeature.State()) {
|
|
FeedFeature()
|
|
}
|
|
)
|
|
.transition(.opacity)
|
|
case .me:
|
|
MeView()
|
|
.transition(.opacity)
|
|
}
|
|
}
|
|
.frame(maxWidth: .infinity, maxHeight: .infinity)
|
|
|
|
// 底部导航栏 - 悬浮在最上层
|
|
VStack {
|
|
Spacer()
|
|
BottomTabView(selectedTab: $selectedTab)
|
|
}
|
|
.padding(.bottom, geometry.safeAreaInsets.bottom + 100)
|
|
}
|
|
}
|
|
.onAppear {
|
|
store.send(.onAppear)
|
|
}
|
|
.sheet(isPresented: Binding(
|
|
get: { store.isSettingPresented },
|
|
set: { _ in store.send(.settingDismissed) }
|
|
)) {
|
|
SettingView(store: store.scope(state: \.settingState, action: \.setting))
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
#Preview {
|
|
HomeView(
|
|
store: Store(
|
|
initialState: HomeFeature.State()
|
|
) {
|
|
HomeFeature()
|
|
}
|
|
)
|
|
}
|