feat: 更新CreateFeed功能及相关视图组件
- 在CreateFeedFeature中新增isPresented依赖,确保在适当的上下文中执行视图关闭操作。 - 在FeedFeature中优化状态管理,简化CreateFeedView的呈现逻辑。 - 新增FeedListFeature和MainFeature,整合FeedListView和底部导航功能,提升用户体验。 - 更新HomeView和SplashView以集成MainView,确保应用结构一致性。 - 在多个视图中调整状态管理和导航逻辑,增强可维护性和用户体验。
This commit is contained in:
35
yana/Features/MainFeature.swift
Normal file
35
yana/Features/MainFeature.swift
Normal file
@@ -0,0 +1,35 @@
|
||||
import Foundation
|
||||
import ComposableArchitecture
|
||||
import CasePaths
|
||||
|
||||
struct MainFeature: Reducer {
|
||||
enum Tab: Int, Equatable, CaseIterable {
|
||||
case feed, other
|
||||
}
|
||||
|
||||
struct State: Equatable {
|
||||
var selectedTab: Tab = .feed
|
||||
var feedList: FeedListFeature.State = .init()
|
||||
}
|
||||
|
||||
@CasePathable
|
||||
enum Action: Equatable {
|
||||
case selectTab(Tab)
|
||||
case feedList(FeedListFeature.Action)
|
||||
}
|
||||
|
||||
var body: some ReducerOf<Self> {
|
||||
Scope(state: \.feedList, action: \.feedList) {
|
||||
FeedListFeature()
|
||||
}
|
||||
Reduce { state, action in
|
||||
switch action {
|
||||
case .selectTab(let tab):
|
||||
state.selectedTab = tab
|
||||
return .none
|
||||
case .feedList:
|
||||
return .none
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user