Skip to content

Commit

Permalink
#37 [Style] TabRouteView 구현
Browse files Browse the repository at this point in the history
  • Loading branch information
soletree committed Apr 24, 2024
1 parent 4eea055 commit f31a59f
Showing 1 changed file with 59 additions and 0 deletions.
59 changes: 59 additions & 0 deletions Score/Score/View/TabRouteView.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
//
// TabRouteView.swift
// Score
//
// Created by sole on 4/24/24.
//

import ComposableArchitecture
import SwiftUI

//MARK: - TabRouteView

struct TabRouteView: View {
let store: StoreOf<SCTabBarFeature>

var body: some View {
NavigationStackStore(
store.scope(state: \.path,
action: \.path)
) {
WithPerceptionTracking {
Text("Root View")
.onAppear {
store.send(.viewAppearing)
}
.fullScreenCover(
store: store.scope(
state: \.$destination.record,
action: \.destination.record)
) { store in
RecordMainView(store: store)
}
}
} destination: { store in
switch store.state {
case .home:
if let store = store.scope(state: \.home,
action: \.home) {
HomeMainView(store: store)
.scTabBar(store: self.store)
}
case .schoolGroup:
if let store = store.scope(state: \.schoolGroup,
action: \.schoolGroup) {
SchoolGroupMainView(store: store)
.scTabBar(store: self.store)
}
}
}
}
}

//MARK: - Preview

#Preview {
TabRouteView(
store: .init(initialState: .init(selectedTab: .home),
reducer: { SCTabBarFeature() }))
}

0 comments on commit f31a59f

Please sign in to comment.