33 lines
724 B
Swift
33 lines
724 B
Swift
//
|
|
// RootView.swift
|
|
// Root
|
|
//
|
|
|
|
import SwiftUI
|
|
import Facts
|
|
import ComposableArchitecture
|
|
|
|
/// The root view of the entire app.
|
|
public struct RootView: View {
|
|
@Bindable var store: StoreOf<RootFeature>
|
|
|
|
public init(store: StoreOf<RootFeature>) {
|
|
self.store = store
|
|
}
|
|
|
|
public var body: some View {
|
|
NavigationStack {
|
|
// Super basic here; I want to show a FactsView scoped to just that feature's `State` and `Action`s.
|
|
FactsView(store: store.scope(state: \.facts, action: \.facts))
|
|
}.onAppear {
|
|
store.send(.viewAppeared)
|
|
}
|
|
}
|
|
}
|
|
|
|
#Preview {
|
|
RootView(store: .init(initialState: RootFeature.State()) {
|
|
RootFeature()
|
|
})
|
|
}
|