import ComposableArchitecture
import SwiftUI
@Reducer
struct AppFeature {
@Reducer
enum Path {
case detail(SyncUpDetail)
case meeting(Meeting, syncUp: SyncUp)
case record(RecordMeeting)
}
@ObservableState
struct State: Equatable {
var path = StackState<Path.State>()
var syncUpsList = SyncUpsList.State()
}
enum Action {
case path(StackActionOf<Path>)
case syncUpsList(SyncUpsList.Action)
}
@Dependency(\.date.now) var now
@Dependency(\.uuid) var uuid
var body: some ReducerOf<Self> {
Scope(state: \.syncUpsList, action: \.syncUpsList) {
SyncUpsList()
}
Reduce { state, action in
switch action {
case .path(.element(_, .detail(.delegate(let delegateAction)))):
switch delegateAction {
case .startMeeting(let sharedSyncUp):
state.path.append(
.record(RecordMeeting.State(syncUp: sharedSyncUp))
)
return .none
}
case .path:
return .none
case .syncUpsList:
return .none
}
}
.forEach(\.path, action: \.path)
}
}