
- 在CreateFeedFeature中新增isPresented依赖,确保在适当的上下文中执行视图关闭操作。 - 在FeedFeature中优化状态管理,简化CreateFeedView的呈现逻辑。 - 新增FeedListFeature和MainFeature,整合FeedListView和底部导航功能,提升用户体验。 - 更新HomeView和SplashView以集成MainView,确保应用结构一致性。 - 在多个视图中调整状态管理和导航逻辑,增强可维护性和用户体验。
68 lines
2.8 KiB
Swift
68 lines
2.8 KiB
Swift
import SwiftUI
|
|
import ComposableArchitecture
|
|
|
|
struct FeedListView: View {
|
|
let store: StoreOf<FeedListFeature>
|
|
|
|
@State private var isEditFeedSheetPresented = false // 本地状态用于 sheet
|
|
|
|
var body: some View {
|
|
WithPerceptionTracking {
|
|
GeometryReader { geometry in
|
|
ZStack {
|
|
// 背景图片
|
|
Image("bg")
|
|
.resizable()
|
|
.aspectRatio(contentMode: .fill)
|
|
.frame(maxWidth: .infinity, maxHeight: .infinity)
|
|
.clipped()
|
|
.ignoresSafeArea(.all)
|
|
VStack(alignment: .center, spacing: 0) {
|
|
// 顶部栏
|
|
HStack {
|
|
Spacer(minLength: 0)
|
|
Spacer(minLength: 0)
|
|
Text("Enjoy your Life Time")
|
|
.font(.system(size: 22, weight: .semibold))
|
|
.foregroundColor(.white)
|
|
.frame(maxWidth: .infinity, alignment: .center)
|
|
Spacer(minLength: 0)
|
|
Button(action: {
|
|
store.send(.editFeedButtonTapped)
|
|
}) {
|
|
Image("add icon")
|
|
.resizable()
|
|
.frame(width: 36, height: 36)
|
|
}
|
|
}
|
|
.padding(.horizontal, 20)
|
|
.padding(.top, geometry.safeAreaInsets.top)
|
|
// 其他内容
|
|
Image(systemName: "heart.fill")
|
|
.font(.system(size: 60))
|
|
.foregroundColor(.red)
|
|
.padding(.top, 40)
|
|
Text("The disease is like a cruel ruler,\nand time is our most precious treasure.\nEvery moment we live is a victory\nagainst the inevitable.")
|
|
.font(.system(size: 16))
|
|
.multilineTextAlignment(.center)
|
|
.foregroundColor(.white.opacity(0.9))
|
|
.padding(.horizontal, 30)
|
|
.padding(.bottom, 30)
|
|
Spacer()
|
|
}
|
|
.frame(maxWidth: .infinity, alignment: .top)
|
|
}
|
|
}
|
|
.onAppear {
|
|
store.send(.onAppear)
|
|
}
|
|
// .sheet(isPresented: store.binding(
|
|
// get: \.isEditFeedPresented,
|
|
// send: { $0 ? .editFeedButtonTapped : .editFeedDismissed }
|
|
// )) {
|
|
// EditFeedView()
|
|
// }
|
|
}
|
|
}
|
|
}
|