
- 在CreateFeedFeature中新增isPresented依赖,确保在适当的上下文中执行视图关闭操作。 - 在FeedFeature中优化状态管理,简化CreateFeedView的呈现逻辑。 - 新增FeedListFeature和MainFeature,整合FeedListView和底部导航功能,提升用户体验。 - 更新HomeView和SplashView以集成MainView,确保应用结构一致性。 - 在多个视图中调整状态管理和导航逻辑,增强可维护性和用户体验。
33 lines
715 B
Swift
33 lines
715 B
Swift
import SwiftUI
|
|
import ComposableArchitecture
|
|
|
|
struct AppRootView: View {
|
|
@State private var isLoggedIn = false
|
|
|
|
var body: some View {
|
|
if isLoggedIn {
|
|
MainView(
|
|
store: Store(
|
|
initialState: MainFeature.State()
|
|
) {
|
|
MainFeature()
|
|
}
|
|
)
|
|
} else {
|
|
LoginView(
|
|
store: Store(
|
|
initialState: LoginFeature.State()
|
|
) {
|
|
LoginFeature()
|
|
},
|
|
onLoginSuccess: {
|
|
isLoggedIn = true
|
|
}
|
|
)
|
|
}
|
|
}
|
|
}
|
|
|
|
#Preview {
|
|
AppRootView()
|
|
} |