mirror of
https://github.com/pointfreeco/swift-composable-architecture.git
synced 2025-12-24 12:14:25 +01:00
* wip
* fix
* wip
* wip
* move
* wip
* wip
* wip
* wip
* wip
* wip
* wip
* wip
* wip
* wip
* wip
* wip
* wip
* wip
* wip
* wip
* wip
* wip
* Fix
* wip
* wip
* Renamed action to onTap in NavigationLinkStore (#2043)
Renamed the `action` parameter to mirror other inits and differentiate itself from `action fromDestinationAction`
* wip
* wip
* wip
* wip
* wip
* wip
* wip
* wip
* wip
* wip
* wip
* wip
* wip
* wip
* Tie view identity to stack element identity
* Tie item identity to case
* wip
* wip
* cleanup
* fix
* fix
* Add warning to nav link
* wip
* wip
* Rename FullscreenCover.swift to FullScreenCover.swift (#2062)
* wip
* fix isDetailLink on non-iOS platforms
* Correct some comments in Effect.swift (#2081)
* add integration tests for showing alert/dialog from alert/dialog.
* copy StackElementIDGenerator dependency before running TestStore receive closure.
* Removed some unneeded delegate actions.
* wip
* clean up
* lots of clean up
* Converted voice memos back to identified array
* update deps
* update docs for DismissEffect
* wip
* Add Sendable conformance to PresentationState (#2086)
* wip
* swift-format
* wip
* wip
* docs
* wip
* wip
* Catch some typos in Articles (#2088)
* wip
* wip
* wip
* wip
* wip
* docs
* wip
* wip
* docs
* wip
* wip
* wip
* wip
* docs
* docs
* wip
* wip
* wip
* wip
* wip
* wip
* wip
* Fix invalid states count for 3 optionals and typos (#2094)
* wip
* wip
* more dismisseffect docs
* fixed some references
* navigation doc corrections
* more nav docs
* fix cancellation tests in release mode
* wrap some tests in #if DEBUG since they are testing expected failures
* update UUIDs in tests to use shorter initializer
* fixed a todo
* wip
* fix merge errors
* wip
* fix
* wip
* wip
* fixing a bunch of todos
* get rid of rawvalue in StackElementID
* more todos
* NavLinkStore docs
* fix swift 5.6 stuff
* fix some standups tests
* fix
* clean up
* docs fix
* fixes
* wip
* 5.6 fix
* wip
* wip
* dont parallelize tests
* updated demo readmes
* wip
* Use ObservedObject instead of StateObject for alert/dialog modifiers.
* integration tests for bad dismissal behavior
* check for runtime warnings in every integration test
* wip
* wip
* fix
* wip
* wip
* wip
* wip
* wip
* Drop a bunch of Hashables.
* some nav bug fixes
* wip
* wip
* wip
* fix
* fix
* wip
* wip
* Simplify recording test.
* add concurrent async test
* fix
* wip
* Refact how detail dismisses itself.
* fix
* 5.6 fix
* wip
* wip
* Add TestStore.assert.
* Revert "Add TestStore.assert."
This reverts commit a892cccc66.
* add Ukrainian Readme.md (#2121)
* Add TestStore.assert. (#2123)
* Add TestStore.assert.
* wip
* Update Sources/ComposableArchitecture/TestStore.swift
Co-authored-by: Stephen Celis <stephen@stephencelis.com>
* Update Sources/ComposableArchitecture/Documentation.docc/Extensions/TestStore.md
Co-authored-by: Stephen Celis <stephen@stephencelis.com>
* fix tests
---------
Co-authored-by: Stephen Celis <stephen@stephencelis.com>
* Run swift-format
* push for store.finish and presentation
* move docs around
* wip
* wip
* wip
* wip
* wip
* wip
* wip
* wip
* wip
* wip
* wip
* wip
* wip
* wip
* Add case subscripts
* wip
* wip
* 5.7-only
* wip
* wip
* wip
* wip
* revert store.finish task cancellation
* wip
* wip
* wip
* wip
* wip
* wip
* wip
* wip
* wip
* wip
* wip
* wip
* wip
* wip
* wip
* wip
* wip
* wip
* wip
* wip
* add test for presentation scope
* wip
* wip
* wip
* wip
* wip
* cleanup
* updated presentation scope test
* sytnax update
* clean up
* fix test
* wip
* wip
* wip
* wip
* wip
---------
Co-authored-by: Brandon Williams <mbrandonw@hey.com>
Co-authored-by: Martin Václavík <mvaclavik96@icloud.com>
Co-authored-by: 유재호 <y73447jh@gmail.com>
Co-authored-by: Jackson Utsch <jutechs@gmail.com>
Co-authored-by: Dmytro <barabashdmyto@gmail.com>
Co-authored-by: Brandon Williams <135203+mbrandonw@users.noreply.github.com>
Co-authored-by: mbrandonw <mbrandonw@users.noreply.github.com>
304 lines
7.9 KiB
Swift
304 lines
7.9 KiB
Swift
import ComposableArchitecture
|
|
import SwiftUI
|
|
|
|
struct RootView: View {
|
|
let store: StoreOf<Root>
|
|
|
|
var body: some View {
|
|
NavigationView {
|
|
Form {
|
|
Section(header: Text("Getting started")) {
|
|
NavigationLink(
|
|
"Basics",
|
|
destination: CounterDemoView(
|
|
store: self.store.scope(
|
|
state: \.counter,
|
|
action: Root.Action.counter
|
|
)
|
|
)
|
|
)
|
|
|
|
NavigationLink(
|
|
"Combining reducers",
|
|
destination: TwoCountersView(
|
|
store: self.store.scope(
|
|
state: \.twoCounters,
|
|
action: Root.Action.twoCounters
|
|
)
|
|
)
|
|
)
|
|
|
|
NavigationLink(
|
|
"Bindings",
|
|
destination: BindingBasicsView(
|
|
store: self.store.scope(
|
|
state: \.bindingBasics,
|
|
action: Root.Action.bindingBasics
|
|
)
|
|
)
|
|
)
|
|
|
|
NavigationLink(
|
|
"Form bindings",
|
|
destination: BindingFormView(
|
|
store: self.store.scope(
|
|
state: \.bindingForm,
|
|
action: Root.Action.bindingForm
|
|
)
|
|
)
|
|
)
|
|
|
|
NavigationLink(
|
|
"Optional state",
|
|
destination: OptionalBasicsView(
|
|
store: self.store.scope(
|
|
state: \.optionalBasics,
|
|
action: Root.Action.optionalBasics
|
|
)
|
|
)
|
|
)
|
|
|
|
NavigationLink(
|
|
"Shared state",
|
|
destination: SharedStateView(
|
|
store: self.store.scope(
|
|
state: \.shared,
|
|
action: Root.Action.shared
|
|
)
|
|
)
|
|
)
|
|
|
|
NavigationLink(
|
|
"Alerts and Confirmation Dialogs",
|
|
destination: AlertAndConfirmationDialogView(
|
|
store: self.store.scope(
|
|
state: \.alertAndConfirmationDialog,
|
|
action: Root.Action.alertAndConfirmationDialog
|
|
)
|
|
)
|
|
)
|
|
|
|
NavigationLink(
|
|
"Focus State",
|
|
destination: FocusDemoView(
|
|
store: self.store.scope(
|
|
state: \.focusDemo,
|
|
action: Root.Action.focusDemo
|
|
)
|
|
)
|
|
)
|
|
|
|
NavigationLink(
|
|
"Animations",
|
|
destination: AnimationsView(
|
|
store: self.store.scope(
|
|
state: \.animation,
|
|
action: Root.Action.animation
|
|
)
|
|
)
|
|
)
|
|
}
|
|
|
|
Section(header: Text("Effects")) {
|
|
NavigationLink(
|
|
"Basics",
|
|
destination: EffectsBasicsView(
|
|
store: self.store.scope(
|
|
state: \.effectsBasics,
|
|
action: Root.Action.effectsBasics
|
|
)
|
|
)
|
|
)
|
|
|
|
NavigationLink(
|
|
"Cancellation",
|
|
destination: EffectsCancellationView(
|
|
store: self.store.scope(
|
|
state: \.effectsCancellation,
|
|
action: Root.Action.effectsCancellation)
|
|
)
|
|
)
|
|
|
|
NavigationLink(
|
|
"Long-living effects",
|
|
destination: LongLivingEffectsView(
|
|
store: self.store.scope(
|
|
state: \.longLivingEffects,
|
|
action: Root.Action.longLivingEffects
|
|
)
|
|
)
|
|
)
|
|
|
|
NavigationLink(
|
|
"Refreshable",
|
|
destination: RefreshableView(
|
|
store: self.store.scope(
|
|
state: \.refreshable,
|
|
action: Root.Action.refreshable
|
|
)
|
|
)
|
|
)
|
|
|
|
NavigationLink(
|
|
"Timers",
|
|
destination: TimersView(
|
|
store: self.store.scope(
|
|
state: \.timers,
|
|
action: Root.Action.timers
|
|
)
|
|
)
|
|
)
|
|
|
|
NavigationLink(
|
|
"Web socket",
|
|
destination: WebSocketView(
|
|
store: self.store.scope(
|
|
state: \.webSocket,
|
|
action: Root.Action.webSocket
|
|
)
|
|
)
|
|
)
|
|
}
|
|
|
|
Section(header: Text("Navigation")) {
|
|
NavigationLink(
|
|
"Stack",
|
|
destination: NavigationDemoView(
|
|
store: self.store.scope(
|
|
state: \.navigationStack,
|
|
action: Root.Action.navigationStack
|
|
)
|
|
)
|
|
)
|
|
|
|
NavigationLink(
|
|
"Navigate and load data",
|
|
destination: NavigateAndLoadView(
|
|
store: self.store.scope(
|
|
state: \.navigateAndLoad,
|
|
action: Root.Action.navigateAndLoad
|
|
)
|
|
)
|
|
)
|
|
|
|
NavigationLink(
|
|
"Load data then navigate",
|
|
destination: LoadThenNavigateView(
|
|
store: self.store.scope(
|
|
state: \.loadThenNavigate,
|
|
action: Root.Action.loadThenNavigate
|
|
)
|
|
)
|
|
)
|
|
|
|
NavigationLink(
|
|
"Lists: Navigate and load data",
|
|
destination: NavigateAndLoadListView(
|
|
store: self.store.scope(
|
|
state: \.navigateAndLoadList,
|
|
action: Root.Action.navigateAndLoadList
|
|
)
|
|
)
|
|
)
|
|
|
|
NavigationLink(
|
|
"Lists: Load data then navigate",
|
|
destination: LoadThenNavigateListView(
|
|
store: self.store.scope(
|
|
state: \.loadThenNavigateList,
|
|
action: Root.Action.loadThenNavigateList
|
|
)
|
|
)
|
|
)
|
|
|
|
NavigationLink(
|
|
"Sheets: Present and load data",
|
|
destination: PresentAndLoadView(
|
|
store: self.store.scope(
|
|
state: \.presentAndLoad,
|
|
action: Root.Action.presentAndLoad
|
|
)
|
|
)
|
|
)
|
|
|
|
NavigationLink(
|
|
"Sheets: Load data then present",
|
|
destination: LoadThenPresentView(
|
|
store: self.store.scope(
|
|
state: \.loadThenPresent,
|
|
action: Root.Action.loadThenPresent
|
|
)
|
|
)
|
|
)
|
|
}
|
|
|
|
Section(header: Text("Higher-order reducers")) {
|
|
NavigationLink(
|
|
"Reusable favoriting component",
|
|
destination: EpisodesView(
|
|
store: self.store.scope(
|
|
state: \.episodes,
|
|
action: Root.Action.episodes
|
|
)
|
|
)
|
|
)
|
|
|
|
NavigationLink(
|
|
"Reusable offline download component",
|
|
destination: CitiesView(
|
|
store: self.store.scope(
|
|
state: \.map,
|
|
action: Root.Action.map
|
|
)
|
|
)
|
|
)
|
|
|
|
NavigationLink(
|
|
"Lifecycle",
|
|
destination: LifecycleDemoView(
|
|
store: self.store.scope(
|
|
state: \.lifecycle,
|
|
action: Root.Action.lifecycle
|
|
)
|
|
)
|
|
)
|
|
|
|
NavigationLink(
|
|
"Elm-like subscriptions",
|
|
destination: ClockView(
|
|
store: self.store.scope(
|
|
state: \.clock,
|
|
action: Root.Action.clock
|
|
)
|
|
)
|
|
)
|
|
|
|
NavigationLink(
|
|
"Recursive state and actions",
|
|
destination: NestedView(
|
|
store: self.store.scope(
|
|
state: \.nested,
|
|
action: Root.Action.nested
|
|
)
|
|
)
|
|
)
|
|
}
|
|
}
|
|
.navigationTitle("Case Studies")
|
|
.onAppear { ViewStore(self.store).send(.onAppear) }
|
|
}
|
|
}
|
|
}
|
|
|
|
// MARK: - SwiftUI previews
|
|
|
|
struct RootView_Previews: PreviewProvider {
|
|
static var previews: some View {
|
|
RootView(
|
|
store: Store(initialState: Root.State()) {
|
|
Root()
|
|
}
|
|
)
|
|
}
|
|
}
|