Skip to content

Commit

Permalink
Merge branch 'update-tca-150'
Browse files Browse the repository at this point in the history
  • Loading branch information
johnpatrickmorgan committed Nov 28, 2023
2 parents 80a2d5e + 89494fe commit c006066
Show file tree
Hide file tree
Showing 9 changed files with 40 additions and 146 deletions.
115 changes: 0 additions & 115 deletions Package.resolved

This file was deleted.

4 changes: 2 additions & 2 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ let package = Package(
),
],
dependencies: [
.package(url: "https://github.com/johnpatrickmorgan/FlowStacks", from: "0.3.0"),
.package(url: "https://github.com/pointfreeco/swift-composable-architecture", from: "1.0.0"),
.package(url: "https://github.com/johnpatrickmorgan/FlowStacks", from: "0.3.6"),
.package(url: "https://github.com/pointfreeco/swift-composable-architecture", from: "1.5.0"),
],
targets: [
.target(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public extension RoutableCollection where Element: RouteProtocol {
/// - Parameter condition: The predicate indicating which screen to pop to.
/// - Returns: A `Bool` indicating whether a screen was found.
@discardableResult
mutating func goBackTo<T>(_ screenCasePath: CasePath<Element.Screen, T>) -> Bool {
mutating func goBackTo<T>(_ screenCasePath: AnyCasePath<Element.Screen, T>) -> Bool {
goBackTo(where: { screenCasePath.extract(from: $0.screen) != nil })
}

Expand All @@ -26,7 +26,7 @@ public extension RoutableCollection where Element: RouteProtocol {
/// - Parameter condition: The predicate indicating which screen to pop to.
/// - Returns: A `Bool` indicating whether a screen was found.
@discardableResult
mutating func popTo<T>(_ screenCasePath: CasePath<Element.Screen, T>) -> Bool {
mutating func popTo<T>(_ screenCasePath: AnyCasePath<Element.Screen, T>) -> Bool {
popTo(where: { screenCasePath.extract(from: $0.screen) != nil })
}
}
4 changes: 2 additions & 2 deletions Sources/TCACoordinators/Reducers/CancelEffectsOnDismiss.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ public struct CancellationIdentity<CoordinatorID: Hashable, RouteID: Hashable>:
struct CancelEffectsOnDismiss<CoordinatorScreensReducer: Reducer, CoordinatorReducer: Reducer, CoordinatorID: Hashable, ScreenAction, RouteID: Hashable, C: Collection>: Reducer where CoordinatorScreensReducer.State == CoordinatorReducer.State, CoordinatorScreensReducer.Action == CoordinatorReducer.Action {
let coordinatedScreensReducer: CoordinatorScreensReducer
let routes: (CoordinatorReducer.State) -> C
let routeAction: CasePath<Action, (RouteID, ScreenAction)>
let routeAction: AnyCasePath<Action, (RouteID, ScreenAction)>
let cancellationId: CoordinatorID?
let getIdentifier: (C.Element, C.Index) -> RouteID
let coordinatorReducer: CoordinatorReducer
Expand Down Expand Up @@ -42,7 +42,7 @@ struct CancelEffectsOnDismiss<CoordinatorScreensReducer: Reducer, CoordinatorRed
struct TagRouteEffectsForCancellation<ScreenReducer: Reducer, CoordinatorID: Hashable, RouteID: Hashable, RouteAction>: Reducer {
let screenReducer: ScreenReducer
let coordinatorId: CoordinatorID
let routeAction: CasePath<Action, (RouteID, RouteAction)>
let routeAction: AnyCasePath<Action, (RouteID, RouteAction)>

var body: some ReducerOf<ScreenReducer> {
Reduce { state, action in
Expand Down
8 changes: 4 additions & 4 deletions Sources/TCACoordinators/Reducers/ForEachIdentifiedRoute.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ struct ForEachIdentifiedRoute<CoordinatorReducer: Reducer, ScreenReducer: Reduce
let screenReducer: ScreenReducer
let cancellationId: CoordinatorID?
let toLocalState: WritableKeyPath<CoordinatorReducer.State, IdentifiedArrayOf<Route<ScreenReducer.State>>>
let toLocalAction: CasePath<CoordinatorReducer.Action, (ScreenReducer.State.ID, ScreenReducer.Action)>
let updateRoutes: CasePath<CoordinatorReducer.Action, IdentifiedArrayOf<Route<ScreenReducer.State>>>
let toLocalAction: AnyCasePath<CoordinatorReducer.Action, (ScreenReducer.State.ID, ScreenReducer.Action)>
let updateRoutes: AnyCasePath<CoordinatorReducer.Action, IdentifiedArrayOf<Route<ScreenReducer.State>>>

var body: some ReducerOf<CoordinatorReducer> {
CancelEffectsOnDismiss(
Expand All @@ -32,8 +32,8 @@ public extension Reducer {
func forEachRoute<ScreenReducer: Reducer, ScreenState, ScreenAction, CoordinatorID: Hashable>(
cancellationId: CoordinatorID?,
toLocalState: WritableKeyPath<Self.State, IdentifiedArrayOf<Route<ScreenReducer.State>>>,
toLocalAction: CasePath<Self.Action, (ScreenReducer.State.ID, ScreenReducer.Action)>,
updateRoutes: CasePath<Self.Action, IdentifiedArrayOf<Route<ScreenReducer.State>>>,
toLocalAction: AnyCasePath<Self.Action, (ScreenReducer.State.ID, ScreenReducer.Action)>,
updateRoutes: AnyCasePath<Self.Action, IdentifiedArrayOf<Route<ScreenReducer.State>>>,
@ReducerBuilder<ScreenState, ScreenAction> screenReducer: () -> ScreenReducer
) -> some ReducerOf<Self>
where ScreenReducer.State: Identifiable,
Expand Down
8 changes: 4 additions & 4 deletions Sources/TCACoordinators/Reducers/ForEachIndexedRoute.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ struct ForEachIndexedRoute<CoordinatorReducer: Reducer, ScreenReducer: Reducer,
let screenReducer: ScreenReducer
let cancellationId: CoordinatorID?
let toLocalState: WritableKeyPath<CoordinatorReducer.State, [Route<ScreenReducer.State>]>
let toLocalAction: CasePath<CoordinatorReducer.Action, (Int, ScreenReducer.Action)>
let updateRoutes: CasePath<CoordinatorReducer.Action, [Route<ScreenReducer.State>]>
let toLocalAction: AnyCasePath<CoordinatorReducer.Action, (Int, ScreenReducer.Action)>
let updateRoutes: AnyCasePath<CoordinatorReducer.Action, [Route<ScreenReducer.State>]>

var body: some ReducerOf<CoordinatorReducer> {
CancelEffectsOnDismiss(
Expand All @@ -32,8 +32,8 @@ public extension Reducer {
func forEachRoute<ScreenReducer: Reducer, ScreenState, ScreenAction, CoordinatorID: Hashable>(
coordinatorIdForCancellation: CoordinatorID?,
toLocalState: WritableKeyPath<Self.State, [Route<ScreenReducer.State>]>,
toLocalAction: CasePath<Self.Action, (Int, ScreenReducer.Action)>,
updateRoutes: CasePath<Self.Action, [Route<ScreenReducer.State>]>,
toLocalAction: AnyCasePath<Self.Action, (Int, ScreenReducer.Action)>,
updateRoutes: AnyCasePath<Self.Action, [Route<ScreenReducer.State>]>,
@ReducerBuilder<ScreenState, ScreenAction> screenReducer: () -> ScreenReducer
) -> some ReducerOf<Self>
where ScreenState == ScreenReducer.State,
Expand Down
6 changes: 3 additions & 3 deletions Sources/TCACoordinators/Reducers/ForEachReducer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import ComposableArchitecture
extension Reducer {
func forEachIndex<ElementState, ElementAction, Element: Reducer>(
_ toElementsState: WritableKeyPath<State, [ElementState]>,
action toElementAction: CasePath<Action, (Int, ElementAction)>,
action toElementAction: AnyCasePath<Action, (Int, ElementAction)>,
@ReducerBuilder<ElementState, ElementAction> element: () -> Element,
file: StaticString = #file,
fileID: StaticString = #fileID,
Expand All @@ -33,7 +33,7 @@ struct _ForEachIndexReducer<
>: Reducer {
let parent: Parent
let toElementsState: WritableKeyPath<Parent.State, [Element.State]>
let toElementAction: CasePath<Parent.Action, (Int, Element.Action)>
let toElementAction: AnyCasePath<Parent.Action, (Int, Element.Action)>
let element: Element
let file: StaticString
let fileID: StaticString
Expand All @@ -42,7 +42,7 @@ struct _ForEachIndexReducer<
init(
parent: Parent,
toElementsState: WritableKeyPath<Parent.State, [Element.State]>,
toElementAction: CasePath<Parent.Action, (Int, Element.Action)>,
toElementAction: AnyCasePath<Parent.Action, (Int, Element.Action)>,
element: Element,
file: StaticString,
fileID: StaticString,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import Foundation

extension Reducer {
@ReducerBuilder<State, Action>
func updatingRoutesOnInteraction<Routes>(updateRoutes: CasePath<Action, Routes>, toLocalState: WritableKeyPath<State, Routes>) -> some ReducerOf<Self> {
func updatingRoutesOnInteraction<Routes>(updateRoutes: AnyCasePath<Action, Routes>, toLocalState: WritableKeyPath<State, Routes>) -> some ReducerOf<Self> {
self
UpdateRoutesOnInteraction(
wrapped: self,
Expand All @@ -15,7 +15,7 @@ extension Reducer {

struct UpdateRoutesOnInteraction<WrappedReducer: Reducer, Routes>: Reducer {
let wrapped: WrappedReducer
let updateRoutes: CasePath<Action, Routes>
let updateRoutes: AnyCasePath<Action, Routes>
let toLocalState: WritableKeyPath<State, Routes>

var body: some ReducerOf<WrappedReducer> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,17 @@
"repositoryURL": "https://github.com/johnpatrickmorgan/FlowStacks",
"state": {
"branch": null,
"revision": "0c5414b018fac906ffce9c4aee7da2a599615c95",
"version": "0.3.4"
"revision": "14a726e093568c3088ecbd4cd5b578059b029c28",
"version": "0.3.6"
}
},
{
"package": "swift-case-paths",
"repositoryURL": "https://github.com/pointfreeco/swift-case-paths",
"state": {
"branch": null,
"revision": "5da6989aae464f324eef5c5b52bdb7974725ab81",
"version": "1.0.0"
"revision": "ed7facdd4a361514b46e3bbc6238cd41c84be4ec",
"version": "1.1.1"
}
},
{
Expand All @@ -51,17 +51,17 @@
"repositoryURL": "https://github.com/pointfreeco/swift-composable-architecture",
"state": {
"branch": null,
"revision": "195284b94b799b326729640453f547f08892293a",
"version": "1.0.0"
"revision": "3f80eb9ed07c16a9f42ac4f23d4dafaa0494568c",
"version": "1.5.0"
}
},
{
"package": "swift-concurrency-extras",
"repositoryURL": "https://github.com/pointfreeco/swift-concurrency-extras",
"state": {
"branch": null,
"revision": "ea631ce892687f5432a833312292b80db238186a",
"version": "1.0.0"
"revision": "bb5059bde9022d69ac516803f4f227d8ac967f71",
"version": "1.1.0"
}
},
{
Expand All @@ -78,8 +78,8 @@
"repositoryURL": "https://github.com/pointfreeco/swift-dependencies",
"state": {
"branch": null,
"revision": "4e1eb6e28afe723286d8cc60611237ffbddba7c5",
"version": "1.0.0"
"revision": "63301f4a181ed9aefb46dccef2dfb66466798341",
"version": "1.1.1"
}
},
{
Expand All @@ -91,13 +91,22 @@
"version": "1.0.0"
}
},
{
"package": "swift-syntax",
"repositoryURL": "https://github.com/apple/swift-syntax",
"state": {
"branch": null,
"revision": "6ad4ea24b01559dde0773e3d091f1b9e36175036",
"version": "509.0.2"
}
},
{
"package": "swiftui-navigation",
"repositoryURL": "https://github.com/pointfreeco/swiftui-navigation",
"state": {
"branch": null,
"revision": "f5bcdac5b6bb3f826916b14705f37a3937c2fd34",
"version": "1.0.0"
"revision": "78f9d72cf667adb47e2040aa373185c88c63f0dc",
"version": "1.2.0"
}
},
{
Expand Down

0 comments on commit c006066

Please sign in to comment.