diff --git a/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/02-ListsOfSyncUps/ListsOfSyncUps.tutorial b/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/02-ListsOfSyncUps/ListsOfSyncUps.tutorial index b01538959bd8..be0dc1c63517 100644 --- a/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/02-ListsOfSyncUps/ListsOfSyncUps.tutorial +++ b/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/02-ListsOfSyncUps/ListsOfSyncUps.tutorial @@ -54,6 +54,9 @@ @Code(name: "Models.swift", file: ListsOfSyncUps-01-code-0003.swift) } + } } diff --git a/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/03-SyncUpForm/SyncUpForm-01-code-0005.swift b/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/03-SyncUpForm/SyncUpForm-01-code-0005.swift index 85b7a10d2b8f..4ea3c7d02179 100644 --- a/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/03-SyncUpForm/SyncUpForm-01-code-0005.swift +++ b/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/03-SyncUpForm/SyncUpForm-01-code-0005.swift @@ -21,8 +21,8 @@ struct SyncUpForm { case .binding: return .none - case let .onDeleteAttendees(indexSet): - state.syncUp.attendees.remove(atOffsets: indexSet) + case let .onDeleteAttendees(indices): + state.syncUp.attendees.remove(atOffsets: indices) if state.syncUp.attendees.isEmpty { state.syncUp.attendees.append( Attendee(id: Attendee.ID()) diff --git a/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/03-SyncUpForm/SyncUpForm-01-code-0006.swift b/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/03-SyncUpForm/SyncUpForm-01-code-0006.swift index 46d32bc01cb5..62110462a50c 100644 --- a/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/03-SyncUpForm/SyncUpForm-01-code-0006.swift +++ b/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/03-SyncUpForm/SyncUpForm-01-code-0006.swift @@ -28,8 +28,8 @@ struct SyncUpForm { case .binding: return .none - case let .onDeleteAttendees(indexSet): - state.syncUp.attendees.remove(atOffsets: indexSet) + case let .onDeleteAttendees(indices): + state.syncUp.attendees.remove(atOffsets: indices) if state.syncUp.attendees.isEmpty { state.syncUp.attendees.append( Attendee(id: Attendee.ID()) diff --git a/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/03-SyncUpForm/SyncUpForm-02-code-0005.swift b/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/03-SyncUpForm/SyncUpForm-02-code-0005.swift index 66b7febfd909..642700abccb7 100644 --- a/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/03-SyncUpForm/SyncUpForm-02-code-0005.swift +++ b/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/03-SyncUpForm/SyncUpForm-02-code-0005.swift @@ -38,19 +38,18 @@ struct SyncUpFormView: View { .focused($focus, equals: .attendee(attendee.id)) } .onDelete { indices in - guard let firstDeletedIndex = indices.first - else { return } - let firstDeletedAttendee = store.syncUp.attendees[firstDeletedIndex] store.send(.onDeleteAttendees(indices)) - guard focus == .attendee(firstDeletedAttendee.id) + guard + !store.syncUp.attendees.isEmpty, + let firstIndex = indices.first else { return } - let index = min(firstDeletedIndex, store.syncUp.attendees.count - 1) + let index = min(firstIndex, store.syncUp.attendees.count - 1) focus = .attendee(store.syncUp.attendees[index].id) } Button("New attendee") { store.send(.addAttendeeButtonTapped) - focus = .attendee(store.attendees.last!.id) + focus = .attendee(store.syncUp.attendees.last!.id) } } header: { Text("Attendees") diff --git a/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/03-SyncUpForm/SyncUpForm-02-code-0006.swift b/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/03-SyncUpForm/SyncUpForm-02-code-0006.swift index 7f16f6534b8e..ebddd8f176c9 100644 --- a/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/03-SyncUpForm/SyncUpForm-02-code-0006.swift +++ b/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/03-SyncUpForm/SyncUpForm-02-code-0006.swift @@ -38,19 +38,18 @@ struct SyncUpFormView: View { .focused($focus, equals: .attendee(attendee.id)) } .onDelete { indices in - guard let firstDeletedIndex = indices.first - else { return } - let firstDeletedAttendee = store.syncUp.attendees[firstDeletedIndex] store.send(.onDeleteAttendees(indices)) - guard focus == .attendee(firstDeletedAttendee.id) + guard + !store.syncUp.attendees.isEmpty, + let firstIndex = indices.first else { return } - let index = min(firstDeletedIndex, store.syncUp.attendees.count - 1) + let index = min(firstIndex, store.syncUp.attendees.count - 1) focus = .attendee(store.syncUp.attendees[index].id) } Button("New attendee") { store.send(.addAttendeeButtonTapped) - focus = .attendee(store.attendees.last!.id) + focus = .attendee(store.syncUp.attendees.last!.id) } } header: { Text("Attendees") diff --git a/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/03-SyncUpForm/SyncUpForm-03-code-0001-previous.swift b/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/03-SyncUpForm/SyncUpForm-03-code-0001-previous.swift index 3aec202bdaef..d4caec89a14c 100644 --- a/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/03-SyncUpForm/SyncUpForm-03-code-0001-previous.swift +++ b/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/03-SyncUpForm/SyncUpForm-03-code-0001-previous.swift @@ -28,8 +28,8 @@ struct SyncUpForm { case .binding: return .none - case let .onDeleteAttendees(indexSet): - state.syncUp.attendees.remove(atOffsets: indexSet) + case let .onDeleteAttendees(indices): + state.syncUp.attendees.remove(atOffsets: indices) if state.syncUp.attendees.isEmpty { state.syncUp.attendees.append( Attendee(id: Attendee.ID()) diff --git a/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/03-SyncUpForm/SyncUpForm-03-code-0001.swift b/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/03-SyncUpForm/SyncUpForm-03-code-0001.swift index 490074d62187..633e5cb21be2 100644 --- a/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/03-SyncUpForm/SyncUpForm-03-code-0001.swift +++ b/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/03-SyncUpForm/SyncUpForm-03-code-0001.swift @@ -34,8 +34,8 @@ struct SyncUpForm { case .binding: return .none - case let .onDeleteAttendees(indexSet): - state.syncUp.attendees.remove(atOffsets: indexSet) + case let .onDeleteAttendees(indices): + state.syncUp.attendees.remove(atOffsets: indices) if state.syncUp.attendees.isEmpty { state.syncUp.attendees.append( Attendee(id: Attendee.ID()) diff --git a/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/03-SyncUpForm/SyncUpForm-03-code-0002.swift b/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/03-SyncUpForm/SyncUpForm-03-code-0002.swift index 88d36ea1b0aa..f411c1ab9498 100644 --- a/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/03-SyncUpForm/SyncUpForm-03-code-0002.swift +++ b/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/03-SyncUpForm/SyncUpForm-03-code-0002.swift @@ -34,8 +34,8 @@ struct SyncUpForm { case .binding: return .none - case let .onDeleteAttendees(indexSet): - state.syncUp.attendees.remove(atOffsets: indexSet) + case let .onDeleteAttendees(indices): + state.syncUp.attendees.remove(atOffsets: indices) if state.syncUp.attendees.isEmpty { state.syncUp.attendees.append( Attendee(id: Attendee.ID()) diff --git a/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/03-SyncUpForm/SyncUpForm-03-code-0003.swift b/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/03-SyncUpForm/SyncUpForm-03-code-0003.swift index df0bff86b5b9..afa2546bd4b7 100644 --- a/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/03-SyncUpForm/SyncUpForm-03-code-0003.swift +++ b/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/03-SyncUpForm/SyncUpForm-03-code-0003.swift @@ -34,23 +34,14 @@ struct SyncUpForm { case .binding: return .none - case let .onDeleteAttendees(indexSet): - guard let firstDeletedIndex = indexSet.first + case let .onDeleteAttendees(indices): + state.syncUp.attendees.remove(atOffsets: indices) + guard + !state.syncUp.attendees.isEmpty, + let firstIndex = indices.first else { return .none } - let firstDeletedAttendee = state.syncUp.attendees[firstDeletedIndex] - - state.syncUp.attendees.remove(atOffsets: indexSet) - if state.syncUp.attendees.isEmpty { - state.syncUp.attendees.append( - Attendee(id: Attendee.ID()) - ) - } - - guard state.focus == .attendee(firstDeletedAttendee.id) - else { return .none } - let index = min(firstDeletedIndex, state.syncUp.attendees.count - 1) + let index = min(firstIndex, state.syncUp.attendees.count - 1) state.focus = .attendee(state.syncUp.attendees[index].id) - return .none } } diff --git a/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/03-SyncUpForm/SyncUpForm-03-code-0004-previous.swift b/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/03-SyncUpForm/SyncUpForm-03-code-0004-previous.swift index 7f16f6534b8e..ebddd8f176c9 100644 --- a/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/03-SyncUpForm/SyncUpForm-03-code-0004-previous.swift +++ b/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/03-SyncUpForm/SyncUpForm-03-code-0004-previous.swift @@ -38,19 +38,18 @@ struct SyncUpFormView: View { .focused($focus, equals: .attendee(attendee.id)) } .onDelete { indices in - guard let firstDeletedIndex = indices.first - else { return } - let firstDeletedAttendee = store.syncUp.attendees[firstDeletedIndex] store.send(.onDeleteAttendees(indices)) - guard focus == .attendee(firstDeletedAttendee.id) + guard + !store.syncUp.attendees.isEmpty, + let firstIndex = indices.first else { return } - let index = min(firstDeletedIndex, store.syncUp.attendees.count - 1) + let index = min(firstIndex, store.syncUp.attendees.count - 1) focus = .attendee(store.syncUp.attendees[index].id) } Button("New attendee") { store.send(.addAttendeeButtonTapped) - focus = .attendee(store.attendees.last!.id) + focus = .attendee(store.syncUp.attendees.last!.id) } } header: { Text("Attendees") diff --git a/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/03-SyncUpForm/SyncUpForm-03-code-0004.swift b/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/03-SyncUpForm/SyncUpForm-03-code-0004.swift index 78673960b299..8f723abb6ab5 100644 --- a/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/03-SyncUpForm/SyncUpForm-03-code-0004.swift +++ b/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/03-SyncUpForm/SyncUpForm-03-code-0004.swift @@ -38,19 +38,19 @@ struct SyncUpFormView: View { .focused($focus, equals: .attendee(attendee.id)) } .onDelete { indices in - // guard let firstDeletedIndex = indices.first - // else { return } - // let firstDeletedAttendee = store.syncUp.attendees[firstDeletedIndex] store.send(.onDeleteAttendees(indices)) - // guard focus == .attendee(firstDeletedAttendee.id) - // else { return } - // let index = min(firstDeletedIndex, store.syncUp.attendees.count - 1) + // store.send(.onDeleteAttendees(indices)) + // guard + // !store.syncUp.attendees.isEmpty, + // let firstIndex = indices.first + // else { return .none } + // let index = min(firstIndex, store.syncUp.attendees.count - 1) // focus = .attendee(store.syncUp.attendees[index].id) } Button("New attendee") { store.send(.addAttendeeButtonTapped) - // focus = .attendee(store.attendees.last!.id) + // focus = .attendee(store.syncUp.attendees.last!.id) } } header: { Text("Attendees") diff --git a/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/03-SyncUpForm/TestingSyncUpForm-02-code-0004-previous.swift b/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/03-SyncUpForm/TestingSyncUpForm-02-code-0004-previous.swift index df0bff86b5b9..afa2546bd4b7 100644 --- a/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/03-SyncUpForm/TestingSyncUpForm-02-code-0004-previous.swift +++ b/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/03-SyncUpForm/TestingSyncUpForm-02-code-0004-previous.swift @@ -34,23 +34,14 @@ struct SyncUpForm { case .binding: return .none - case let .onDeleteAttendees(indexSet): - guard let firstDeletedIndex = indexSet.first + case let .onDeleteAttendees(indices): + state.syncUp.attendees.remove(atOffsets: indices) + guard + !state.syncUp.attendees.isEmpty, + let firstIndex = indices.first else { return .none } - let firstDeletedAttendee = state.syncUp.attendees[firstDeletedIndex] - - state.syncUp.attendees.remove(atOffsets: indexSet) - if state.syncUp.attendees.isEmpty { - state.syncUp.attendees.append( - Attendee(id: Attendee.ID()) - ) - } - - guard state.focus == .attendee(firstDeletedAttendee.id) - else { return .none } - let index = min(firstDeletedIndex, state.syncUp.attendees.count - 1) + let index = min(firstIndex, state.syncUp.attendees.count - 1) state.focus = .attendee(state.syncUp.attendees[index].id) - return .none } } diff --git a/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/03-SyncUpForm/TestingSyncUpForm-02-code-0004.swift b/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/03-SyncUpForm/TestingSyncUpForm-02-code-0004.swift index 15ca4ee03967..afa49b2b7982 100644 --- a/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/03-SyncUpForm/TestingSyncUpForm-02-code-0004.swift +++ b/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/03-SyncUpForm/TestingSyncUpForm-02-code-0004.swift @@ -36,23 +36,14 @@ struct SyncUpForm { case .binding: return .none - case let .onDeleteAttendees(indexSet): - guard let firstDeletedIndex = indexSet.first + case let .onDeleteAttendees(indices): + state.syncUp.attendees.remove(atOffsets: indices) + guard + !state.syncUp.attendees.isEmpty, + let firstIndex = indices.first else { return .none } - let firstDeletedAttendee = state.syncUp.attendees[firstDeletedIndex] - - state.syncUp.attendees.remove(atOffsets: indexSet) - if state.syncUp.attendees.isEmpty { - state.syncUp.attendees.append( - Attendee(id: Attendee.ID()) - ) - } - - guard state.focus == .attendee(firstDeletedAttendee.id) - else { return .none } - let index = min(firstDeletedIndex, state.syncUp.attendees.count - 1) + let index = min(firstIndex, state.syncUp.attendees.count - 1) state.focus = .attendee(state.syncUp.attendees[index].id) - return .none } } diff --git a/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/03-SyncUpForm/TestingSyncUpForm-02-code-0005.swift b/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/03-SyncUpForm/TestingSyncUpForm-02-code-0005.swift index 8229b7f58631..aacb6311d6e1 100644 --- a/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/03-SyncUpForm/TestingSyncUpForm-02-code-0005.swift +++ b/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/03-SyncUpForm/TestingSyncUpForm-02-code-0005.swift @@ -36,23 +36,14 @@ struct SyncUpForm { case .binding: return .none - case let .onDeleteAttendees(indexSet): - guard let firstDeletedIndex = indexSet.first + case let .onDeleteAttendees(indices): + state.syncUp.attendees.remove(atOffsets: indices) + guard + !state.syncUp.attendees.isEmpty, + let firstIndex = indices.first else { return .none } - let firstDeletedAttendee = state.syncUp.attendees[firstDeletedIndex] - - state.syncUp.attendees.remove(atOffsets: indexSet) - if state.syncUp.attendees.isEmpty { - state.syncUp.attendees.append( - Attendee(id: uuid()) - ) - } - - guard state.focus == .attendee(firstDeletedAttendee.id) - else { return .none } - let index = min(firstDeletedIndex, state.syncUp.attendees.count - 1) + let index = min(firstIndex, state.syncUp.attendees.count - 1) state.focus = .attendee(state.syncUp.attendees[index].id) - return .none } } diff --git a/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/06-SyncUpDetail/EditingAndDeletingSyncUp-01-code-0001-previous.swift b/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/06-SyncUpDetail/EditingAndDeletingSyncUp-01-code-0001-previous.swift index d2c09dbd54cf..d834cb32dcdd 100644 --- a/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/06-SyncUpDetail/EditingAndDeletingSyncUp-01-code-0001-previous.swift +++ b/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/06-SyncUpDetail/EditingAndDeletingSyncUp-01-code-0001-previous.swift @@ -4,7 +4,7 @@ import SwiftUI @Reducer struct SyncUpDetail { @ObservableState - struct State { + struct State: Equatable { @Shared var syncUp: SyncUp } diff --git a/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/06-SyncUpDetail/EditingAndDeletingSyncUp-01-code-0001.swift b/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/06-SyncUpDetail/EditingAndDeletingSyncUp-01-code-0001.swift index 3d43f6a9e491..624d5d660821 100644 --- a/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/06-SyncUpDetail/EditingAndDeletingSyncUp-01-code-0001.swift +++ b/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/06-SyncUpDetail/EditingAndDeletingSyncUp-01-code-0001.swift @@ -4,7 +4,7 @@ import SwiftUI @Reducer struct SyncUpDetail { @ObservableState - struct State { + struct State: Equatable { @Presents var editSyncUp: SyncUpForm.State? @Shared var syncUp: SyncUp } diff --git a/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/06-SyncUpDetail/EditingAndDeletingSyncUp-01-code-0002.swift b/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/06-SyncUpDetail/EditingAndDeletingSyncUp-01-code-0002.swift index 1a38ff9ef896..9c27dab66a15 100644 --- a/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/06-SyncUpDetail/EditingAndDeletingSyncUp-01-code-0002.swift +++ b/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/06-SyncUpDetail/EditingAndDeletingSyncUp-01-code-0002.swift @@ -4,7 +4,7 @@ import SwiftUI @Reducer struct SyncUpDetail { @ObservableState - struct State { + struct State: Equatable { @Presents var editSyncUp: SyncUpForm.State? @Shared var syncUp: SyncUp } diff --git a/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/06-SyncUpDetail/EditingAndDeletingSyncUp-01-code-0003.swift b/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/06-SyncUpDetail/EditingAndDeletingSyncUp-01-code-0003.swift index 22a4618a13ab..9c1944eb21a7 100644 --- a/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/06-SyncUpDetail/EditingAndDeletingSyncUp-01-code-0003.swift +++ b/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/06-SyncUpDetail/EditingAndDeletingSyncUp-01-code-0003.swift @@ -4,7 +4,7 @@ import SwiftUI @Reducer struct SyncUpDetail { @ObservableState - struct State { + struct State: Equatable { @Presents var editSyncUp: SyncUpForm.State? @Shared var syncUp: SyncUp } diff --git a/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/06-SyncUpDetail/EditingAndDeletingSyncUp-01-code-0004.swift b/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/06-SyncUpDetail/EditingAndDeletingSyncUp-01-code-0004.swift index 6de9568f3b04..261421255cae 100644 --- a/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/06-SyncUpDetail/EditingAndDeletingSyncUp-01-code-0004.swift +++ b/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/06-SyncUpDetail/EditingAndDeletingSyncUp-01-code-0004.swift @@ -4,7 +4,7 @@ import SwiftUI @Reducer struct SyncUpDetail { @ObservableState - struct State { + struct State: Equatable { @Presents var editSyncUp: SyncUpForm.State? @Shared var syncUp: SyncUp } diff --git a/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/06-SyncUpDetail/EditingAndDeletingSyncUp-01-code-0005-previous.swift b/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/06-SyncUpDetail/EditingAndDeletingSyncUp-01-code-0005-previous.swift index 74470f6ed819..e96d64981fc0 100644 --- a/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/06-SyncUpDetail/EditingAndDeletingSyncUp-01-code-0005-previous.swift +++ b/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/06-SyncUpDetail/EditingAndDeletingSyncUp-01-code-0005-previous.swift @@ -70,6 +70,7 @@ struct SyncUpDetailView: View { .frame(maxWidth: .infinity) } } + .navigationTitle(Text(store.syncUp.title)) .toolbar { Button("Edit") { store.send(.editButtonTapped) diff --git a/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/06-SyncUpDetail/EditingAndDeletingSyncUp-01-code-0005.swift b/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/06-SyncUpDetail/EditingAndDeletingSyncUp-01-code-0005.swift index 79a3a9b8aa39..05f1c9acdb15 100644 --- a/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/06-SyncUpDetail/EditingAndDeletingSyncUp-01-code-0005.swift +++ b/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/06-SyncUpDetail/EditingAndDeletingSyncUp-01-code-0005.swift @@ -70,6 +70,7 @@ struct SyncUpDetailView: View { .frame(maxWidth: .infinity) } } + .navigationTitle(Text(store.syncUp.title)) .toolbar { Button("Edit") { store.send(.editButtonTapped) diff --git a/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/06-SyncUpDetail/EditingAndDeletingSyncUp-01-code-0006.swift b/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/06-SyncUpDetail/EditingAndDeletingSyncUp-01-code-0006.swift index 105b09945e20..e5c56a0e811d 100644 --- a/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/06-SyncUpDetail/EditingAndDeletingSyncUp-01-code-0006.swift +++ b/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/06-SyncUpDetail/EditingAndDeletingSyncUp-01-code-0006.swift @@ -70,6 +70,7 @@ struct SyncUpDetailView: View { .frame(maxWidth: .infinity) } } + .navigationTitle(Text(store.syncUp.title)) .toolbar { Button("Edit") { store.send(.editButtonTapped) diff --git a/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/06-SyncUpDetail/EditingAndDeletingSyncUp-01-code-0007.swift b/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/06-SyncUpDetail/EditingAndDeletingSyncUp-01-code-0007.swift index 4c801304ee68..fcb57fc5e83c 100644 --- a/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/06-SyncUpDetail/EditingAndDeletingSyncUp-01-code-0007.swift +++ b/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/06-SyncUpDetail/EditingAndDeletingSyncUp-01-code-0007.swift @@ -70,6 +70,7 @@ struct SyncUpDetailView: View { .frame(maxWidth: .infinity) } } + .navigationTitle(Text(store.syncUp.title)) .toolbar { Button("Edit") { store.send(.editButtonTapped) diff --git a/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/06-SyncUpDetail/EditingAndDeletingSyncUp-01-code-0008.swift b/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/06-SyncUpDetail/EditingAndDeletingSyncUp-01-code-0008.swift index 5504b5740855..f7777ec2663b 100644 --- a/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/06-SyncUpDetail/EditingAndDeletingSyncUp-01-code-0008.swift +++ b/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/06-SyncUpDetail/EditingAndDeletingSyncUp-01-code-0008.swift @@ -70,6 +70,7 @@ struct SyncUpDetailView: View { .frame(maxWidth: .infinity) } } + .navigationTitle(Text(store.syncUp.title)) .toolbar { Button("Edit") { store.send(.editButtonTapped) @@ -95,26 +96,26 @@ struct SyncUpDetailView: View { } } - #Preview { - NavigationStack { - SyncUpDetailView( - store: Store( - initialState: SyncUpDetail.State( - syncUp: Shared( - SyncUp( - id: SyncUp.ID(), - attendees: [ - Attendee(id: Attendee.ID(), name: "Blob"), - Attendee(id: Attendee.ID(), name: "Blob Jr."), - Attendee(id: Attendee.ID(), name: "Blob Sr."), - ], - title: "Point-Free Morning Sync" - ) +#Preview { + NavigationStack { + SyncUpDetailView( + store: Store( + initialState: SyncUpDetail.State( + syncUp: Shared( + SyncUp( + id: SyncUp.ID(), + attendees: [ + Attendee(id: Attendee.ID(), name: "Blob"), + Attendee(id: Attendee.ID(), name: "Blob Jr."), + Attendee(id: Attendee.ID(), name: "Blob Sr."), + ], + title: "Point-Free Morning Sync" ) ) - ) { - SyncUpDetail() - } - ) - } + ) + ) { + SyncUpDetail() + } + ) } +} diff --git a/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/06-SyncUpDetail/EditingAndDeletingSyncUp-01-code-0009-previous.swift b/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/06-SyncUpDetail/EditingAndDeletingSyncUp-01-code-0009-previous.swift index 6de9568f3b04..261421255cae 100644 --- a/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/06-SyncUpDetail/EditingAndDeletingSyncUp-01-code-0009-previous.swift +++ b/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/06-SyncUpDetail/EditingAndDeletingSyncUp-01-code-0009-previous.swift @@ -4,7 +4,7 @@ import SwiftUI @Reducer struct SyncUpDetail { @ObservableState - struct State { + struct State: Equatable { @Presents var editSyncUp: SyncUpForm.State? @Shared var syncUp: SyncUp } diff --git a/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/06-SyncUpDetail/EditingAndDeletingSyncUp-01-code-0009.swift b/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/06-SyncUpDetail/EditingAndDeletingSyncUp-01-code-0009.swift index a323dcae40d3..aebedcd703f2 100644 --- a/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/06-SyncUpDetail/EditingAndDeletingSyncUp-01-code-0009.swift +++ b/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/06-SyncUpDetail/EditingAndDeletingSyncUp-01-code-0009.swift @@ -4,7 +4,7 @@ import SwiftUI @Reducer struct SyncUpDetail { @ObservableState - struct State { + struct State: Equatable { @Presents var editSyncUp: SyncUpForm.State? @Shared var syncUp: SyncUp } diff --git a/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/06-SyncUpDetail/EditingAndDeletingSyncUp-01-code-0010.swift b/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/06-SyncUpDetail/EditingAndDeletingSyncUp-01-code-0010.swift index 6074ec0e0fb0..8a2bc02657e3 100644 --- a/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/06-SyncUpDetail/EditingAndDeletingSyncUp-01-code-0010.swift +++ b/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/06-SyncUpDetail/EditingAndDeletingSyncUp-01-code-0010.swift @@ -4,7 +4,7 @@ import SwiftUI @Reducer struct SyncUpDetail { @ObservableState - struct State { + struct State: Equatable { @Presents var editSyncUp: SyncUpForm.State? @Shared var syncUp: SyncUp } diff --git a/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/06-SyncUpDetail/EditingAndDeletingSyncUp-01-code-0011.swift b/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/06-SyncUpDetail/EditingAndDeletingSyncUp-01-code-0011.swift index ad7fa1f0b8bb..17a7e60191c4 100644 --- a/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/06-SyncUpDetail/EditingAndDeletingSyncUp-01-code-0011.swift +++ b/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/06-SyncUpDetail/EditingAndDeletingSyncUp-01-code-0011.swift @@ -4,7 +4,7 @@ import SwiftUI @Reducer struct SyncUpDetail { @ObservableState - struct State { + struct State: Equatable { @Presents var editSyncUp: SyncUpForm.State? @Shared var syncUp: SyncUp } diff --git a/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/06-SyncUpDetail/EditingAndDeletingSyncUp-02-code-0001-previous.swift b/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/06-SyncUpDetail/EditingAndDeletingSyncUp-02-code-0001-previous.swift index ad7fa1f0b8bb..17a7e60191c4 100644 --- a/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/06-SyncUpDetail/EditingAndDeletingSyncUp-02-code-0001-previous.swift +++ b/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/06-SyncUpDetail/EditingAndDeletingSyncUp-02-code-0001-previous.swift @@ -4,7 +4,7 @@ import SwiftUI @Reducer struct SyncUpDetail { @ObservableState - struct State { + struct State: Equatable { @Presents var editSyncUp: SyncUpForm.State? @Shared var syncUp: SyncUp } diff --git a/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/06-SyncUpDetail/EditingAndDeletingSyncUp-02-code-0001.swift b/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/06-SyncUpDetail/EditingAndDeletingSyncUp-02-code-0001.swift index fb40ca0ddd58..ec7825060ade 100644 --- a/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/06-SyncUpDetail/EditingAndDeletingSyncUp-02-code-0001.swift +++ b/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/06-SyncUpDetail/EditingAndDeletingSyncUp-02-code-0001.swift @@ -4,7 +4,7 @@ import SwiftUI @Reducer struct SyncUpDetail { @ObservableState - struct State { + struct State: Equatable { @Presents var editSyncUp: SyncUpForm.State? @Shared var syncUp: SyncUp } diff --git a/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/06-SyncUpDetail/EditingAndDeletingSyncUp-02-code-0002.swift b/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/06-SyncUpDetail/EditingAndDeletingSyncUp-02-code-0002.swift index 81ecd44cd5f5..8c5306d2a9af 100644 --- a/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/06-SyncUpDetail/EditingAndDeletingSyncUp-02-code-0002.swift +++ b/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/06-SyncUpDetail/EditingAndDeletingSyncUp-02-code-0002.swift @@ -4,7 +4,7 @@ import SwiftUI @Reducer struct SyncUpDetail { @ObservableState - struct State { + struct State: Equatable { @Presents var alert: AlertState? @Presents var editSyncUp: SyncUpForm.State? @Shared var syncUp: SyncUp diff --git a/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/06-SyncUpDetail/EditingAndDeletingSyncUp-02-code-0003.swift b/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/06-SyncUpDetail/EditingAndDeletingSyncUp-02-code-0003.swift index 8b089fe1ce48..ab2b3b5512dd 100644 --- a/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/06-SyncUpDetail/EditingAndDeletingSyncUp-02-code-0003.swift +++ b/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/06-SyncUpDetail/EditingAndDeletingSyncUp-02-code-0003.swift @@ -4,7 +4,7 @@ import SwiftUI @Reducer struct SyncUpDetail { @ObservableState - struct State { + struct State: Equatable { @Presents var alert: AlertState? @Presents var editSyncUp: SyncUpForm.State? @Shared var syncUp: SyncUp diff --git a/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/06-SyncUpDetail/EditingAndDeletingSyncUp-02-code-0004.swift b/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/06-SyncUpDetail/EditingAndDeletingSyncUp-02-code-0004.swift index edf7244559d3..dc53fec18c3d 100644 --- a/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/06-SyncUpDetail/EditingAndDeletingSyncUp-02-code-0004.swift +++ b/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/06-SyncUpDetail/EditingAndDeletingSyncUp-02-code-0004.swift @@ -4,7 +4,7 @@ import SwiftUI @Reducer struct SyncUpDetail { @ObservableState - struct State { + struct State: Equatable { @Presents var alert: AlertState? @Presents var editSyncUp: SyncUpForm.State? @Shared var syncUp: SyncUp diff --git a/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/06-SyncUpDetail/EditingAndDeletingSyncUp-02-code-0005.swift b/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/06-SyncUpDetail/EditingAndDeletingSyncUp-02-code-0005.swift index e3db2202eb44..cde15ae59e6d 100644 --- a/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/06-SyncUpDetail/EditingAndDeletingSyncUp-02-code-0005.swift +++ b/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/06-SyncUpDetail/EditingAndDeletingSyncUp-02-code-0005.swift @@ -4,7 +4,7 @@ import SwiftUI @Reducer struct SyncUpDetail { @ObservableState - struct State { + struct State: Equatable { @Presents var alert: AlertState? @Presents var editSyncUp: SyncUpForm.State? @Shared var syncUp: SyncUp diff --git a/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/06-SyncUpDetail/EditingAndDeletingSyncUp-02-code-0006.swift b/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/06-SyncUpDetail/EditingAndDeletingSyncUp-02-code-0006.swift index f2db3bc46a8d..0e46ccfb27d4 100644 --- a/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/06-SyncUpDetail/EditingAndDeletingSyncUp-02-code-0006.swift +++ b/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/06-SyncUpDetail/EditingAndDeletingSyncUp-02-code-0006.swift @@ -4,7 +4,7 @@ import SwiftUI @Reducer struct SyncUpDetail { @ObservableState - struct State { + struct State: Equatable { @Presents var alert: AlertState? @Presents var editSyncUp: SyncUpForm.State? @Shared var syncUp: SyncUp diff --git a/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/06-SyncUpDetail/EditingAndDeletingSyncUp-02-code-0007.swift b/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/06-SyncUpDetail/EditingAndDeletingSyncUp-02-code-0007.swift index 73fffc829dee..fc156e1655a0 100644 --- a/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/06-SyncUpDetail/EditingAndDeletingSyncUp-02-code-0007.swift +++ b/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/06-SyncUpDetail/EditingAndDeletingSyncUp-02-code-0007.swift @@ -4,7 +4,7 @@ import SwiftUI @Reducer struct SyncUpDetail { @ObservableState - struct State { + struct State: Equatable { @Presents var alert: AlertState? @Presents var editSyncUp: SyncUpForm.State? @Shared var syncUp: SyncUp diff --git a/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/06-SyncUpDetail/EditingAndDeletingSyncUp-02-code-0008.swift b/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/06-SyncUpDetail/EditingAndDeletingSyncUp-02-code-0008.swift index 39a0e29ac4d5..7f78cf9cf7bf 100644 --- a/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/06-SyncUpDetail/EditingAndDeletingSyncUp-02-code-0008.swift +++ b/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/06-SyncUpDetail/EditingAndDeletingSyncUp-02-code-0008.swift @@ -4,7 +4,7 @@ import SwiftUI @Reducer struct SyncUpDetail { @ObservableState - struct State { + struct State: Equatable { @Presents var alert: AlertState? @Presents var editSyncUp: SyncUpForm.State? @Shared var syncUp: SyncUp diff --git a/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/06-SyncUpDetail/EditingAndDeletingSyncUp-02-code-0009.swift b/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/06-SyncUpDetail/EditingAndDeletingSyncUp-02-code-0009.swift index dc0627db8f94..f9dd57baa08b 100644 --- a/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/06-SyncUpDetail/EditingAndDeletingSyncUp-02-code-0009.swift +++ b/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/06-SyncUpDetail/EditingAndDeletingSyncUp-02-code-0009.swift @@ -4,7 +4,7 @@ import SwiftUI @Reducer struct SyncUpDetail { @ObservableState - struct State { + struct State: Equatable { @Presents var alert: AlertState? @Presents var editSyncUp: SyncUpForm.State? @Shared var syncUp: SyncUp diff --git a/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/06-SyncUpDetail/EditingAndDeletingSyncUp-02-code-0010.swift b/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/06-SyncUpDetail/EditingAndDeletingSyncUp-02-code-0010.swift index bde9ad36fbc4..232a73f58518 100644 --- a/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/06-SyncUpDetail/EditingAndDeletingSyncUp-02-code-0010.swift +++ b/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/06-SyncUpDetail/EditingAndDeletingSyncUp-02-code-0010.swift @@ -4,7 +4,7 @@ import SwiftUI @Reducer struct SyncUpDetail { @ObservableState - struct State { + struct State: Equatable { @Presents var alert: AlertState? @Presents var editSyncUp: SyncUpForm.State? @Shared var syncUp: SyncUp diff --git a/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/06-SyncUpDetail/EditingAndDeletingSyncUp-02-code-0011.swift b/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/06-SyncUpDetail/EditingAndDeletingSyncUp-02-code-0011.swift index f3ae902c684a..2cf2303b51f9 100644 --- a/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/06-SyncUpDetail/EditingAndDeletingSyncUp-02-code-0011.swift +++ b/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/06-SyncUpDetail/EditingAndDeletingSyncUp-02-code-0011.swift @@ -4,7 +4,7 @@ import SwiftUI @Reducer struct SyncUpDetail { @ObservableState - struct State { + struct State: Equatable { @Presents var alert: AlertState? @Presents var editSyncUp: SyncUpForm.State? @Shared var syncUp: SyncUp diff --git a/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/06-SyncUpDetail/EditingAndDeletingSyncUp-02-code-0012.swift b/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/06-SyncUpDetail/EditingAndDeletingSyncUp-02-code-0012.swift index 197b9683aed0..33ade45dbca5 100644 --- a/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/06-SyncUpDetail/EditingAndDeletingSyncUp-02-code-0012.swift +++ b/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/06-SyncUpDetail/EditingAndDeletingSyncUp-02-code-0012.swift @@ -4,7 +4,7 @@ import SwiftUI @Reducer struct SyncUpDetail { @ObservableState - struct State { + struct State: Equatable { @Presents var alert: AlertState? @Presents var editSyncUp: SyncUpForm.State? @Shared var syncUp: SyncUp diff --git a/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/06-SyncUpDetail/EditingAndDeletingSyncUp-02-code-0013.swift b/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/06-SyncUpDetail/EditingAndDeletingSyncUp-02-code-0013.swift index 2764f112191b..9857c1050053 100644 --- a/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/06-SyncUpDetail/EditingAndDeletingSyncUp-02-code-0013.swift +++ b/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/06-SyncUpDetail/EditingAndDeletingSyncUp-02-code-0013.swift @@ -4,7 +4,7 @@ import SwiftUI @Reducer struct SyncUpDetail { @ObservableState - struct State { + struct State: Equatable { @Presents var alert: AlertState? @Presents var editSyncUp: SyncUpForm.State? @Shared var syncUp: SyncUp diff --git a/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/06-SyncUpDetail/EditingAndDeletingSyncUp-02-code-0014-previous.swift b/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/06-SyncUpDetail/EditingAndDeletingSyncUp-02-code-0014-previous.swift index 1144779eac9b..39b15defae65 100644 --- a/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/06-SyncUpDetail/EditingAndDeletingSyncUp-02-code-0014-previous.swift +++ b/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/06-SyncUpDetail/EditingAndDeletingSyncUp-02-code-0014-previous.swift @@ -70,6 +70,7 @@ struct SyncUpDetailView: View { .frame(maxWidth: .infinity) } } + .navigationTitle(Text(store.syncUp.title)) .toolbar { Button("Edit") { store.send(.editButtonTapped) diff --git a/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/06-SyncUpDetail/EditingAndDeletingSyncUp-02-code-0014.swift b/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/06-SyncUpDetail/EditingAndDeletingSyncUp-02-code-0014.swift index 1aa30f924b7a..12f0585cbdb0 100644 --- a/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/06-SyncUpDetail/EditingAndDeletingSyncUp-02-code-0014.swift +++ b/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/06-SyncUpDetail/EditingAndDeletingSyncUp-02-code-0014.swift @@ -70,6 +70,7 @@ struct SyncUpDetailView: View { .frame(maxWidth: .infinity) } } + .navigationTitle(Text(store.syncUp.title)) .toolbar { Button("Edit") { store.send(.editButtonTapped) diff --git a/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/06-SyncUpDetail/EditingAndDeletingSyncUp-03-code-0001.swift b/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/06-SyncUpDetail/EditingAndDeletingSyncUp-03-code-0001.swift index 113223fc3098..03194ff3250a 100644 --- a/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/06-SyncUpDetail/EditingAndDeletingSyncUp-03-code-0001.swift +++ b/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/06-SyncUpDetail/EditingAndDeletingSyncUp-03-code-0001.swift @@ -3,7 +3,7 @@ import SwiftUI @Reducer struct SyncUpDetail { - @Reducer + @Reducer(state: .equatable) enum Destination { } // ... diff --git a/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/06-SyncUpDetail/EditingAndDeletingSyncUp-03-code-0002.swift b/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/06-SyncUpDetail/EditingAndDeletingSyncUp-03-code-0002.swift index 34760b97c92d..43d07518d0f7 100644 --- a/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/06-SyncUpDetail/EditingAndDeletingSyncUp-03-code-0002.swift +++ b/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/06-SyncUpDetail/EditingAndDeletingSyncUp-03-code-0002.swift @@ -3,7 +3,7 @@ import SwiftUI @Reducer struct SyncUpDetail { - @Reducer + @Reducer(state: .equatable) enum Destination { case alert(AlertState) case edit(SyncUpForm) diff --git a/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/06-SyncUpDetail/EditingAndDeletingSyncUp-03-code-0003-previous.swift b/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/06-SyncUpDetail/EditingAndDeletingSyncUp-03-code-0003-previous.swift index b5ccd83e654e..135647d74f22 100644 --- a/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/06-SyncUpDetail/EditingAndDeletingSyncUp-03-code-0003-previous.swift +++ b/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/06-SyncUpDetail/EditingAndDeletingSyncUp-03-code-0003-previous.swift @@ -3,7 +3,7 @@ import SwiftUI @Reducer struct SyncUpDetail { - @Reducer + @Reducer(state: .equatable) enum Destination { case alert(AlertState) case edit(SyncUpForm) @@ -14,7 +14,7 @@ struct SyncUpDetail { } @ObservableState - struct State { + struct State: Equatable { @Presents var alert: AlertState? @Presents var editSyncUp: SyncUpForm.State? @Shared var syncUp: SyncUp @@ -39,10 +39,9 @@ struct SyncUpDetail { Reduce { state, action in switch action { case .alert(.presented(.confirmButtonTapped)): - return .run { send in - await send(.delegate(.deleteSyncUp(id: state.syncUp.id))) - await dismiss() - } + @Shared(.fileStorage(.syncUps)) var syncUps: IdentifiedArrayOf = [] + syncUps.remove(id: state.syncUp.id) + return .run { _ in await dismiss() } case .alert(.dismiss): return .none diff --git a/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/06-SyncUpDetail/EditingAndDeletingSyncUp-03-code-0003.swift b/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/06-SyncUpDetail/EditingAndDeletingSyncUp-03-code-0003.swift index bd92e2416dba..79a9459c899b 100644 --- a/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/06-SyncUpDetail/EditingAndDeletingSyncUp-03-code-0003.swift +++ b/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/06-SyncUpDetail/EditingAndDeletingSyncUp-03-code-0003.swift @@ -3,7 +3,7 @@ import SwiftUI @Reducer struct SyncUpDetail { - @Reducer + @Reducer(state: .equatable) enum Destination { case alert(AlertState) case edit(SyncUpForm) @@ -14,7 +14,7 @@ struct SyncUpDetail { } @ObservableState - struct State { + struct State: Equatable { // @Presents var alert: AlertState? // @Presents var editSyncUp: SyncUpForm.State? @Presents var destination: Destination.State? @@ -40,10 +40,9 @@ struct SyncUpDetail { Reduce { state, action in switch action { case .alert(.presented(.confirmButtonTapped)): - return .run { send in - await send(.delegate(.deleteSyncUp(id: state.syncUp.id))) - await dismiss() - } + @Shared(.fileStorage(.syncUps)) var syncUps: IdentifiedArrayOf = [] + syncUps.remove(id: state.syncUp.id) + return .run { _ in await dismiss() } case .alert(.dismiss): return .none diff --git a/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/06-SyncUpDetail/EditingAndDeletingSyncUp-03-code-0004.swift b/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/06-SyncUpDetail/EditingAndDeletingSyncUp-03-code-0004.swift index ecd10bf60482..ad3277823456 100644 --- a/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/06-SyncUpDetail/EditingAndDeletingSyncUp-03-code-0004.swift +++ b/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/06-SyncUpDetail/EditingAndDeletingSyncUp-03-code-0004.swift @@ -3,7 +3,7 @@ import SwiftUI @Reducer struct SyncUpDetail { - @Reducer + @Reducer(state: .equatable) enum Destination { case alert(AlertState) case edit(SyncUpForm) @@ -14,7 +14,7 @@ struct SyncUpDetail { } @ObservableState - struct State { + struct State: Equatable { @Presents var destination: Destination.State? @Shared var syncUp: SyncUp } @@ -38,10 +38,9 @@ struct SyncUpDetail { Reduce { state, action in switch action { case .alert(.presented(.confirmButtonTapped)): - return .run { send in - await send(.delegate(.deleteSyncUp(id: state.syncUp.id))) - await dismiss() - } + @Shared(.fileStorage(.syncUps)) var syncUps: IdentifiedArrayOf = [] + syncUps.remove(id: state.syncUp.id) + return .run { _ in await dismiss() } case .alert(.dismiss): return .none diff --git a/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/06-SyncUpDetail/EditingAndDeletingSyncUp-03-code-0005.swift b/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/06-SyncUpDetail/EditingAndDeletingSyncUp-03-code-0005.swift index 61846e07e20a..e4be3107c284 100644 --- a/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/06-SyncUpDetail/EditingAndDeletingSyncUp-03-code-0005.swift +++ b/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/06-SyncUpDetail/EditingAndDeletingSyncUp-03-code-0005.swift @@ -3,7 +3,7 @@ import SwiftUI @Reducer struct SyncUpDetail { - @Reducer + @Reducer(state: .equatable) enum Destination { case alert(AlertState) case edit(SyncUpForm) @@ -14,7 +14,7 @@ struct SyncUpDetail { } @ObservableState - struct State { + struct State: Equatable { @Presents var destination: Destination.State? @Shared var syncUp: SyncUp } @@ -25,10 +25,6 @@ struct SyncUpDetail { case destination(PresentationAction) case doneEditingButtonTapped case editButtonTapped - @CasePathable - enum Alert { - case confirmButtonTapped - } } @Dependency(\.dismiss) var dismiss @@ -37,10 +33,9 @@ struct SyncUpDetail { Reduce { state, action in switch action { case .alert(.presented(.confirmButtonTapped)): - return .run { send in - await send(.delegate(.deleteSyncUp(id: state.syncUp.id))) - await dismiss() - } + @Shared(.fileStorage(.syncUps)) var syncUps: IdentifiedArrayOf = [] + syncUps.remove(id: state.syncUp.id) + return .run { _ in await dismiss() } case .alert(.dismiss): return .none diff --git a/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/06-SyncUpDetail/EditingAndDeletingSyncUp-03-code-0006.swift b/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/06-SyncUpDetail/EditingAndDeletingSyncUp-03-code-0006.swift index 22a6612f921f..e0bbaa7a80ce 100644 --- a/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/06-SyncUpDetail/EditingAndDeletingSyncUp-03-code-0006.swift +++ b/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/06-SyncUpDetail/EditingAndDeletingSyncUp-03-code-0006.swift @@ -3,7 +3,7 @@ import SwiftUI @Reducer struct SyncUpDetail { - @Reducer + @Reducer(state: .equatable) enum Destination { case alert(AlertState) case edit(SyncUpForm) @@ -14,7 +14,7 @@ struct SyncUpDetail { } @ObservableState - struct State { + struct State: Equatable { @Presents var destination: Destination.State? @Shared var syncUp: SyncUp } @@ -25,10 +25,6 @@ struct SyncUpDetail { case destination(PresentationAction) case doneEditingButtonTapped case editButtonTapped - @CasePathable - enum Alert { - case confirmButtonTapped - } } @Dependency(\.dismiss) var dismiss @@ -38,10 +34,9 @@ struct SyncUpDetail { switch action { // case .alert(.presented(.confirmButtonTapped)): case .destination(.presented(.alert(.confirmButtonTapped))): - return .run { send in - await send(.delegate(.deleteSyncUp(id: state.syncUp.id))) - await dismiss() - } + @Shared(.fileStorage(.syncUps)) var syncUps: IdentifiedArrayOf = [] + syncUps.remove(id: state.syncUp.id) + return .run { _ in await dismiss() } case .alert(.dismiss): return .none diff --git a/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/06-SyncUpDetail/EditingAndDeletingSyncUp-03-code-0007.swift b/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/06-SyncUpDetail/EditingAndDeletingSyncUp-03-code-0007.swift index ba103b653a8b..24815c2ede4d 100644 --- a/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/06-SyncUpDetail/EditingAndDeletingSyncUp-03-code-0007.swift +++ b/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/06-SyncUpDetail/EditingAndDeletingSyncUp-03-code-0007.swift @@ -3,7 +3,7 @@ import SwiftUI @Reducer struct SyncUpDetail { - @Reducer + @Reducer(state: .equatable) enum Destination { case alert(AlertState) case edit(SyncUpForm) @@ -14,7 +14,7 @@ struct SyncUpDetail { } @ObservableState - struct State { + struct State: Equatable { @Presents var destination: Destination.State? @Shared var syncUp: SyncUp } @@ -25,10 +25,6 @@ struct SyncUpDetail { case destination(PresentationAction) case doneEditingButtonTapped case editButtonTapped - @CasePathable - enum Alert { - case confirmButtonTapped - } } @Dependency(\.dismiss) var dismiss @@ -38,10 +34,9 @@ struct SyncUpDetail { switch action { // case .alert(.presented(.confirmButtonTapped)): case .destination(.presented(.alert(.confirmButtonTapped))): - return .run { send in - await send(.delegate(.deleteSyncUp(id: state.syncUp.id))) - await dismiss() - } + @Shared(.fileStorage(.syncUps)) var syncUps: IdentifiedArrayOf = [] + syncUps.remove(id: state.syncUp.id) + return .run { _ in await dismiss() } case .destination: return .none diff --git a/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/06-SyncUpDetail/EditingAndDeletingSyncUp-03-code-0008.swift b/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/06-SyncUpDetail/EditingAndDeletingSyncUp-03-code-0008.swift index 34f234488f7b..ed8f21796dd4 100644 --- a/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/06-SyncUpDetail/EditingAndDeletingSyncUp-03-code-0008.swift +++ b/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/06-SyncUpDetail/EditingAndDeletingSyncUp-03-code-0008.swift @@ -3,7 +3,7 @@ import SwiftUI @Reducer struct SyncUpDetail { - @Reducer + @Reducer(state: .equatable) enum Destination { case alert(AlertState) case edit(SyncUpForm) @@ -14,7 +14,7 @@ struct SyncUpDetail { } @ObservableState - struct State { + struct State: Equatable { @Presents var destination: Destination.State? @Shared var syncUp: SyncUp } @@ -25,10 +25,6 @@ struct SyncUpDetail { case destination(PresentationAction) case doneEditingButtonTapped case editButtonTapped - @CasePathable - enum Alert { - case confirmButtonTapped - } } @Dependency(\.dismiss) var dismiss @@ -38,10 +34,9 @@ struct SyncUpDetail { switch action { // case .alert(.presented(.confirmButtonTapped)): case .destination(.presented(.alert(.confirmButtonTapped))): - return .run { send in - await send(.delegate(.deleteSyncUp(id: state.syncUp.id))) - await dismiss() - } + @Shared(.fileStorage(.syncUps)) var syncUps: IdentifiedArrayOf = [] + syncUps.remove(id: state.syncUp.id) + return .run { _ in await dismiss() } case .destination: return .none diff --git a/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/06-SyncUpDetail/EditingAndDeletingSyncUp-03-code-0009.swift b/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/06-SyncUpDetail/EditingAndDeletingSyncUp-03-code-0009.swift index 381952bb3990..ee6027763c52 100644 --- a/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/06-SyncUpDetail/EditingAndDeletingSyncUp-03-code-0009.swift +++ b/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/06-SyncUpDetail/EditingAndDeletingSyncUp-03-code-0009.swift @@ -3,7 +3,7 @@ import SwiftUI @Reducer struct SyncUpDetail { - @Reducer + @Reducer(state: .equatable) enum Destination { case alert(AlertState) case edit(SyncUpForm) @@ -14,7 +14,7 @@ struct SyncUpDetail { } @ObservableState - struct State { + struct State: Equatable { @Presents var destination: Destination.State? @Shared var syncUp: SyncUp } @@ -25,10 +25,6 @@ struct SyncUpDetail { case destination(PresentationAction) case doneEditingButtonTapped case editButtonTapped - @CasePathable - enum Alert { - case confirmButtonTapped - } } @Dependency(\.dismiss) var dismiss @@ -38,11 +34,10 @@ struct SyncUpDetail { switch action { // case .alert(.presented(.confirmButtonTapped)): case .destination(.presented(.alert(.confirmButtonTapped))): - return .run { send in - await send(.delegate(.deleteSyncUp(id: state.syncUp.id))) - await dismiss() - } - + @Shared(.fileStorage(.syncUps)) var syncUps: IdentifiedArrayOf = [] + syncUps.remove(id: state.syncUp.id) + return .run { _ in await dismiss() } + case .destination: return .none diff --git a/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/06-SyncUpDetail/EditingAndDeletingSyncUp-03-code-0010.swift b/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/06-SyncUpDetail/EditingAndDeletingSyncUp-03-code-0010.swift index 427ebc310ee1..057a0e08aec4 100644 --- a/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/06-SyncUpDetail/EditingAndDeletingSyncUp-03-code-0010.swift +++ b/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/06-SyncUpDetail/EditingAndDeletingSyncUp-03-code-0010.swift @@ -3,7 +3,7 @@ import SwiftUI @Reducer struct SyncUpDetail { - @Reducer + @Reducer(state: .equatable) enum Destination { case alert(AlertState) case edit(SyncUpForm) @@ -14,7 +14,7 @@ struct SyncUpDetail { } @ObservableState - struct State { + struct State: Equatable { @Presents var destination: Destination.State? @Shared var syncUp: SyncUp } @@ -25,10 +25,6 @@ struct SyncUpDetail { case destination(PresentationAction) case doneEditingButtonTapped case editButtonTapped - @CasePathable - enum Alert { - case confirmButtonTapped - } } @Dependency(\.dismiss) var dismiss @@ -38,10 +34,9 @@ struct SyncUpDetail { switch action { // case .alert(.presented(.confirmButtonTapped)): case .destination(.presented(.alert(.confirmButtonTapped))): - return .run { send in - await send(.delegate(.deleteSyncUp(id: state.syncUp.id))) - await dismiss() - } + @Shared(.fileStorage(.syncUps)) var syncUps: IdentifiedArrayOf = [] + syncUps.remove(id: state.syncUp.id) + return .run { _ in await dismiss() } case .destination: return .none diff --git a/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/06-SyncUpDetail/EditingAndDeletingSyncUp-03-code-0011.swift b/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/06-SyncUpDetail/EditingAndDeletingSyncUp-03-code-0011.swift index 7bf086be1f40..56778f6ef93a 100644 --- a/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/06-SyncUpDetail/EditingAndDeletingSyncUp-03-code-0011.swift +++ b/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/06-SyncUpDetail/EditingAndDeletingSyncUp-03-code-0011.swift @@ -3,7 +3,7 @@ import SwiftUI @Reducer struct SyncUpDetail { - @Reducer + @Reducer(state: .equatable) enum Destination { case alert(AlertState) case edit(SyncUpForm) @@ -14,7 +14,7 @@ struct SyncUpDetail { } @ObservableState - struct State { + struct State: Equatable { @Presents var destination: Destination.State? @Shared var syncUp: SyncUp } @@ -25,10 +25,6 @@ struct SyncUpDetail { case destination(PresentationAction) case doneEditingButtonTapped case editButtonTapped - @CasePathable - enum Alert { - case confirmButtonTapped - } } @Dependency(\.dismiss) var dismiss @@ -38,10 +34,9 @@ struct SyncUpDetail { switch action { // case .alert(.presented(.confirmButtonTapped)): case .destination(.presented(.alert(.confirmButtonTapped))): - return .run { send in - await send(.delegate(.deleteSyncUp(id: state.syncUp.id))) - await dismiss() - } + @Shared(.fileStorage(.syncUps)) var syncUps: IdentifiedArrayOf = [] + syncUps.remove(id: state.syncUp.id) + return .run { _ in await dismiss() } case .destination: return .none diff --git a/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/06-SyncUpDetail/EditingAndDeletingSyncUp-03-code-0012.swift b/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/06-SyncUpDetail/EditingAndDeletingSyncUp-03-code-0012.swift index 29b2ee442af6..9cb3dc6bdadf 100644 --- a/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/06-SyncUpDetail/EditingAndDeletingSyncUp-03-code-0012.swift +++ b/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/06-SyncUpDetail/EditingAndDeletingSyncUp-03-code-0012.swift @@ -3,7 +3,7 @@ import SwiftUI @Reducer struct SyncUpDetail { - @Reducer + @Reducer(state: .equatable) enum Destination { case alert(AlertState) case edit(SyncUpForm) @@ -14,7 +14,7 @@ struct SyncUpDetail { } @ObservableState - struct State { + struct State: Equatable { @Presents var destination: Destination.State? @Shared var syncUp: SyncUp } @@ -25,10 +25,6 @@ struct SyncUpDetail { case destination(PresentationAction) case doneEditingButtonTapped case editButtonTapped - @CasePathable - enum Alert { - case confirmButtonTapped - } } @Dependency(\.dismiss) var dismiss @@ -38,10 +34,9 @@ struct SyncUpDetail { switch action { // case .alert(.presented(.confirmButtonTapped)): case .destination(.presented(.alert(.confirmButtonTapped))): - return .run { send in - await send(.delegate(.deleteSyncUp(id: state.syncUp.id))) - await dismiss() - } + @Shared(.fileStorage(.syncUps)) var syncUps: IdentifiedArrayOf = [] + syncUps.remove(id: state.syncUp.id) + return .run { _ in await dismiss() } case .destination: return .none diff --git a/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/06-SyncUpDetail/EditingAndDeletingSyncUp-03-code-0013-previous.swift b/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/06-SyncUpDetail/EditingAndDeletingSyncUp-03-code-0013-previous.swift index 1aa30f924b7a..12f0585cbdb0 100644 --- a/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/06-SyncUpDetail/EditingAndDeletingSyncUp-03-code-0013-previous.swift +++ b/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/06-SyncUpDetail/EditingAndDeletingSyncUp-03-code-0013-previous.swift @@ -70,6 +70,7 @@ struct SyncUpDetailView: View { .frame(maxWidth: .infinity) } } + .navigationTitle(Text(store.syncUp.title)) .toolbar { Button("Edit") { store.send(.editButtonTapped) diff --git a/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/06-SyncUpDetail/EditingAndDeletingSyncUp-03-code-0013.swift b/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/06-SyncUpDetail/EditingAndDeletingSyncUp-03-code-0013.swift index a3dd82a49c1b..ff0e84075f6e 100644 --- a/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/06-SyncUpDetail/EditingAndDeletingSyncUp-03-code-0013.swift +++ b/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/06-SyncUpDetail/EditingAndDeletingSyncUp-03-code-0013.swift @@ -75,6 +75,7 @@ struct SyncUpDetailView: View { store.send(.editButtonTapped) } } + .navigationTitle(Text(store.syncUp.title)) .alert($store.scope(state: \.destination?.alert, action: \.destination.alert)) .sheet( item: $store.scope(state: \.destination?.edit, action: \.destination.edit) diff --git a/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/06-SyncUpDetail/EditingAndDeletingSyncUp.tutorial b/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/06-SyncUpDetail/EditingAndDeletingSyncUp.tutorial index d9382f2802f8..2ada9d7f5e9f 100644 --- a/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/06-SyncUpDetail/EditingAndDeletingSyncUp.tutorial +++ b/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/06-SyncUpDetail/EditingAndDeletingSyncUp.tutorial @@ -153,6 +153,11 @@ deletion, and we do not have to model the cancel action. That is automatically taken care of by the library's navigation tools. + > Note: We are pre-emptively applying the `@CasePathable` macro to make it possible to write + tests against these actions in a keypath-like syntax. The `@CasePathable` macro is + automatically applied to `Action` enums inside reducers, but macros cannot recursive apply + themselves and so we must do it manually sometimes. + @Code(name: "SyncUpDetail.swift", file: EditingAndDeletingSyncUp-02-code-0001.swift, previousFile: EditingAndDeletingSyncUp-02-code-0001-previous.swift) } @@ -359,6 +364,13 @@ we have encountered so far. The [`@Reducer`]() has special behavior when applied to enums that allows one to compose multiple reducers into a single package. + > Important: As we have seen it is important for `State` types to be `Equatable` for + testing, and so we are proactively making the `State` type generated for the `Destination` + reducer equatable via the `state` argument of + ``ComposableArchitecture/Reducer(state:action:)``. See the article + for more information of why this is the necessary + way to make `State` equatable. + > Note: We have collapsed the implementation of `SyncUpDetail` and `SyncUpDetailView` in > this code snippet. diff --git a/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/06-SyncUpDetail/SyncUpDetail-01-code-0001.swift b/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/06-SyncUpDetail/SyncUpDetail-01-code-0001.swift index 9cdfbc319e09..11efa117f00f 100644 --- a/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/06-SyncUpDetail/SyncUpDetail-01-code-0001.swift +++ b/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/06-SyncUpDetail/SyncUpDetail-01-code-0001.swift @@ -4,7 +4,7 @@ import SwiftUI @Reducer struct SyncUpDetail { @ObservableState - struct State { + struct State: Equatable { } enum Action { diff --git a/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/06-SyncUpDetail/SyncUpDetail-01-code-0002.swift b/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/06-SyncUpDetail/SyncUpDetail-01-code-0002.swift index 84152619621e..0cfb59a3b384 100644 --- a/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/06-SyncUpDetail/SyncUpDetail-01-code-0002.swift +++ b/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/06-SyncUpDetail/SyncUpDetail-01-code-0002.swift @@ -4,7 +4,7 @@ import SwiftUI @Reducer struct SyncUpDetail { @ObservableState - struct State { + struct State: Equatable { @Shared var syncUp: SyncUp } diff --git a/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/06-SyncUpDetail/SyncUpDetail-01-code-0003.swift b/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/06-SyncUpDetail/SyncUpDetail-01-code-0003.swift index 1ee51aa02aec..3d29e95174ae 100644 --- a/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/06-SyncUpDetail/SyncUpDetail-01-code-0003.swift +++ b/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/06-SyncUpDetail/SyncUpDetail-01-code-0003.swift @@ -4,7 +4,7 @@ import SwiftUI @Reducer struct SyncUpDetail { @ObservableState - struct State { + struct State: Equatable { @Shared var syncUp: SyncUp } diff --git a/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/06-SyncUpDetail/SyncUpDetail-01-code-0004.swift b/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/06-SyncUpDetail/SyncUpDetail-01-code-0004.swift index 3fa3a9276b9a..28f712aa247e 100644 --- a/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/06-SyncUpDetail/SyncUpDetail-01-code-0004.swift +++ b/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/06-SyncUpDetail/SyncUpDetail-01-code-0004.swift @@ -4,7 +4,7 @@ import SwiftUI @Reducer struct SyncUpDetail { @ObservableState - struct State { + struct State: Equatable { @Shared var syncUp: SyncUp } diff --git a/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/06-SyncUpDetail/SyncUpDetail-01-code-0006.swift b/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/06-SyncUpDetail/SyncUpDetail-01-code-0006.swift index 79c8d55b8d9c..38463b5be776 100644 --- a/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/06-SyncUpDetail/SyncUpDetail-01-code-0006.swift +++ b/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/06-SyncUpDetail/SyncUpDetail-01-code-0006.swift @@ -70,6 +70,7 @@ struct SyncUpDetailView: View { .frame(maxWidth: .infinity) } } + .navigationTitle(Text(store.syncUp.title)) .toolbar { Button("Edit") { store.send(.editButtonTapped) diff --git a/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/06-SyncUpDetail/SyncUpDetail-01-code-0007.swift b/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/06-SyncUpDetail/SyncUpDetail-01-code-0007.swift index 74470f6ed819..e96d64981fc0 100644 --- a/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/06-SyncUpDetail/SyncUpDetail-01-code-0007.swift +++ b/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/06-SyncUpDetail/SyncUpDetail-01-code-0007.swift @@ -70,6 +70,7 @@ struct SyncUpDetailView: View { .frame(maxWidth: .infinity) } } + .navigationTitle(Text(store.syncUp.title)) .toolbar { Button("Edit") { store.send(.editButtonTapped) diff --git a/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/06-SyncUpDetail/TestingSyncUpDetail-01-code-0002.swift b/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/06-SyncUpDetail/TestingSyncUpDetail-01-code-0002.swift index 724f6d2070a0..2a60ab8d6e23 100644 --- a/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/06-SyncUpDetail/TestingSyncUpDetail-01-code-0002.swift +++ b/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/06-SyncUpDetail/TestingSyncUpDetail-01-code-0002.swift @@ -10,7 +10,7 @@ class SyncUpDetailTests: XCTestCase { id: SyncUp.ID(), title: "Point-Free Morning Sync" ) - let store = TestStore(initialState: SyncUpDetail.State(syncUp: syncUp)) { + let store = TestStore(initialState: SyncUpDetail.State(syncUp: Shared(syncUp))) { SyncUpDetail() } } diff --git a/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/06-SyncUpDetail/TestingSyncUpDetail-01-code-0003.swift b/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/06-SyncUpDetail/TestingSyncUpDetail-01-code-0003.swift index f91ff0b5e5aa..a91a174d06cf 100644 --- a/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/06-SyncUpDetail/TestingSyncUpDetail-01-code-0003.swift +++ b/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/06-SyncUpDetail/TestingSyncUpDetail-01-code-0003.swift @@ -10,7 +10,7 @@ class SyncUpDetailTests: XCTestCase { id: SyncUp.ID(), title: "Point-Free Morning Sync" ) - let store = TestStore(initialState: SyncUpDetail.State(syncUp: syncUp)) { + let store = TestStore(initialState: SyncUpDetail.State(syncUp: Shared(syncUp))) { SyncUpDetail() } diff --git a/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/06-SyncUpDetail/TestingSyncUpDetail-01-code-0004.swift b/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/06-SyncUpDetail/TestingSyncUpDetail-01-code-0004.swift index b4c0d935564c..369376b3bd9a 100644 --- a/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/06-SyncUpDetail/TestingSyncUpDetail-01-code-0004.swift +++ b/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/06-SyncUpDetail/TestingSyncUpDetail-01-code-0004.swift @@ -10,7 +10,7 @@ class SyncUpDetailTests: XCTestCase { id: SyncUp.ID(), title: "Point-Free Morning Sync" ) - let store = TestStore(initialState: SyncUpDetail.State(syncUp: syncUp)) { + let store = TestStore(initialState: SyncUpDetail.State(syncUp: Shared(syncUp))) { SyncUpDetail() } diff --git a/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/06-SyncUpDetail/TestingSyncUpDetail-01-code-0005.swift b/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/06-SyncUpDetail/TestingSyncUpDetail-01-code-0005.swift index 191ce769c712..43e993e94883 100644 --- a/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/06-SyncUpDetail/TestingSyncUpDetail-01-code-0005.swift +++ b/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/06-SyncUpDetail/TestingSyncUpDetail-01-code-0005.swift @@ -10,7 +10,7 @@ class SyncUpDetailTests: XCTestCase { id: SyncUp.ID(), title: "Point-Free Morning Sync" ) - let store = TestStore(initialState: SyncUpDetail.State(syncUp: syncUp)) { + let store = TestStore(initialState: SyncUpDetail.State(syncUp: Shared(syncUp))) { SyncUpDetail() } @@ -21,7 +21,7 @@ class SyncUpDetailTests: XCTestCase { var editedSyncUp = syncUp editedSyncUp.title = "Point-Free Evening Sync" await store.send(\.destination.edit.binding.syncUp, editedSyncUp) { - $0.$destination?.edit?.syncUp = editedSyncUp + $0.destination?.edit?.syncUp = editedSyncUp } } } diff --git a/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/06-SyncUpDetail/TestingSyncUpDetail-01-code-0006.swift b/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/06-SyncUpDetail/TestingSyncUpDetail-01-code-0006.swift index 2ef01fa2d0d9..2136cedb8289 100644 --- a/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/06-SyncUpDetail/TestingSyncUpDetail-01-code-0006.swift +++ b/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/06-SyncUpDetail/TestingSyncUpDetail-01-code-0006.swift @@ -10,7 +10,7 @@ class SyncUpDetailTests: XCTestCase { id: SyncUp.ID(), title: "Point-Free Morning Sync" ) - let store = TestStore(initialState: SyncUpDetail.State(syncUp: syncUp)) { + let store = TestStore(initialState: SyncUpDetail.State(syncUp: Shared(syncUp))) { SyncUpDetail() } @@ -21,7 +21,7 @@ class SyncUpDetailTests: XCTestCase { var editedSyncUp = syncUp editedSyncUp.title = "Point-Free Evening Sync" await store.send(\.destination.edit.binding.syncUp, editedSyncUp) { - $0.$destination?.edit?.syncUp = editedSyncUp + $0.destination?.edit?.syncUp = editedSyncUp } await store.send(.doneEditingButtonTapped) { diff --git a/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/06-SyncUpDetail/TestingSyncUpDetail-02-code-0001.swift b/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/06-SyncUpDetail/TestingSyncUpDetail-02-code-0001.swift index d2575cd86c13..9b4dd7c6645e 100644 --- a/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/06-SyncUpDetail/TestingSyncUpDetail-02-code-0001.swift +++ b/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/06-SyncUpDetail/TestingSyncUpDetail-02-code-0001.swift @@ -10,7 +10,7 @@ class SyncUpDetailTests: XCTestCase { id: SyncUp.ID(), title: "Point-Free Morning Sync" ) - let store = TestStore(initialState: SyncUpDetail.State(syncUp: syncUp)) { + let store = TestStore(initialState: SyncUpDetail.State(syncUp: Shared(syncUp))) { SyncUpDetail() } } diff --git a/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/06-SyncUpDetail/TestingSyncUpDetail-02-code-0002.swift b/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/06-SyncUpDetail/TestingSyncUpDetail-02-code-0002.swift index 13706e12a403..dd2a3e48b593 100644 --- a/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/06-SyncUpDetail/TestingSyncUpDetail-02-code-0002.swift +++ b/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/06-SyncUpDetail/TestingSyncUpDetail-02-code-0002.swift @@ -10,7 +10,7 @@ class SyncUpDetailTests: XCTestCase { id: SyncUp.ID(), title: "Point-Free Morning Sync" ) - let store = TestStore(initialState: SyncUpDetail.State(syncUp: syncUp)) { + let store = TestStore(initialState: SyncUpDetail.State(syncUp: Shared(syncUp))) { SyncUpDetail() } diff --git a/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/06-SyncUpDetail/TestingSyncUpDetail-02-code-0003.swift b/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/06-SyncUpDetail/TestingSyncUpDetail-02-code-0003.swift index 2520b8df11d4..c0f91269b77b 100644 --- a/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/06-SyncUpDetail/TestingSyncUpDetail-02-code-0003.swift +++ b/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/06-SyncUpDetail/TestingSyncUpDetail-02-code-0003.swift @@ -10,7 +10,7 @@ class SyncUpDetailTests: XCTestCase { id: SyncUp.ID(), title: "Point-Free Morning Sync" ) - let store = TestStore(initialState: SyncUpDetail.State(syncUp: syncUp)) { + let store = TestStore(initialState: SyncUpDetail.State(syncUp: Shared(syncUp))) { SyncUpDetail() } diff --git a/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/06-SyncUpDetail/TestingSyncUpDetail-02-code-0004.swift b/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/06-SyncUpDetail/TestingSyncUpDetail-02-code-0004.swift index 2a05cffce5ec..75f7bca34621 100644 --- a/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/06-SyncUpDetail/TestingSyncUpDetail-02-code-0004.swift +++ b/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/06-SyncUpDetail/TestingSyncUpDetail-02-code-0004.swift @@ -10,7 +10,7 @@ class SyncUpDetailTests: XCTestCase { id: SyncUp.ID(), title: "Point-Free Morning Sync" ) - let store = TestStore(initialState: SyncUpDetail.State(syncUp: syncUp)) { + let store = TestStore(initialState: SyncUpDetail.State(syncUp: Shared(syncUp))) { SyncUpDetail() } diff --git a/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/06-SyncUpDetail/TestingSyncUpDetail-02-code-0005.swift b/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/06-SyncUpDetail/TestingSyncUpDetail-02-code-0005.swift index 8a45227a9a15..3dcc4a54f977 100644 --- a/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/06-SyncUpDetail/TestingSyncUpDetail-02-code-0005.swift +++ b/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/06-SyncUpDetail/TestingSyncUpDetail-02-code-0005.swift @@ -10,7 +10,7 @@ class SyncUpDetailTests: XCTestCase { id: SyncUp.ID(), title: "Point-Free Morning Sync" ) - let store = TestStore(initialState: SyncUpDetail.State(syncUp: syncUp)) { + let store = TestStore(initialState: SyncUpDetail.State(syncUp: Shared(syncUp))) { SyncUpDetail() } diff --git a/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/06-SyncUpDetail/TestingSyncUpDetail-02-code-0006.swift b/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/06-SyncUpDetail/TestingSyncUpDetail-02-code-0006.swift index 8a45227a9a15..3dcc4a54f977 100644 --- a/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/06-SyncUpDetail/TestingSyncUpDetail-02-code-0006.swift +++ b/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/06-SyncUpDetail/TestingSyncUpDetail-02-code-0006.swift @@ -10,7 +10,7 @@ class SyncUpDetailTests: XCTestCase { id: SyncUp.ID(), title: "Point-Free Morning Sync" ) - let store = TestStore(initialState: SyncUpDetail.State(syncUp: syncUp)) { + let store = TestStore(initialState: SyncUpDetail.State(syncUp: Shared(syncUp))) { SyncUpDetail() } diff --git a/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/06-SyncUpDetail/TestingSyncUpDetail-02-code-0007.swift b/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/06-SyncUpDetail/TestingSyncUpDetail-02-code-0007.swift index b6b7f89822ca..27568797fbca 100644 --- a/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/06-SyncUpDetail/TestingSyncUpDetail-02-code-0007.swift +++ b/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/06-SyncUpDetail/TestingSyncUpDetail-02-code-0007.swift @@ -10,7 +10,7 @@ class SyncUpDetailTests: XCTestCase { id: SyncUp.ID(), title: "Point-Free Morning Sync" ) - let store = TestStore(initialState: SyncUpDetail.State(syncUp: syncUp)) { + let store = TestStore(initialState: SyncUpDetail.State(syncUp: Shared(syncUp))) { SyncUpDetail() } withDependencies: { } diff --git a/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/07-SyncUpDetailNavigation/MeetingNavigation-02-code-0004-previous.swift b/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/07-SyncUpDetailNavigation/MeetingNavigation-02-code-0004-previous.swift index 49d3a900e15d..861b84f0df26 100644 --- a/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/07-SyncUpDetailNavigation/MeetingNavigation-02-code-0004-previous.swift +++ b/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/07-SyncUpDetailNavigation/MeetingNavigation-02-code-0004-previous.swift @@ -70,6 +70,7 @@ struct SyncUpDetailView: View { .frame(maxWidth: .infinity) } } + .navigationTitle(Text(store.syncUp.title)) .toolbar { Button("Edit") { store.send(.editButtonTapped) diff --git a/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/07-SyncUpDetailNavigation/MeetingNavigation-02-code-0004.swift b/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/07-SyncUpDetailNavigation/MeetingNavigation-02-code-0004.swift index a34fa2c2f89a..aca3d30e5175 100644 --- a/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/07-SyncUpDetailNavigation/MeetingNavigation-02-code-0004.swift +++ b/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/07-SyncUpDetailNavigation/MeetingNavigation-02-code-0004.swift @@ -71,6 +71,7 @@ struct SyncUpDetailView: View { .frame(maxWidth: .infinity) } } + .navigationTitle(Text(store.syncUp.title)) .toolbar { Button("Edit") { store.send(.editButtonTapped) diff --git a/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/07-SyncUpDetailNavigation/SyncUpDetailNavigation-01-code-0001.swift b/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/07-SyncUpDetailNavigation/SyncUpDetailNavigation-01-code-0001.swift index 8adfa29cda47..08fc993ea3aa 100644 --- a/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/07-SyncUpDetailNavigation/SyncUpDetailNavigation-01-code-0001.swift +++ b/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/07-SyncUpDetailNavigation/SyncUpDetailNavigation-01-code-0001.swift @@ -4,7 +4,7 @@ import SwiftUI @Reducer struct App { @ObservableState - struct State { + struct State: Equatable { } enum Action { } diff --git a/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/07-SyncUpDetailNavigation/SyncUpDetailNavigation-01-code-0002.swift b/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/07-SyncUpDetailNavigation/SyncUpDetailNavigation-01-code-0002.swift index f9092e85340a..f4cb3b6ff72e 100644 --- a/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/07-SyncUpDetailNavigation/SyncUpDetailNavigation-01-code-0002.swift +++ b/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/07-SyncUpDetailNavigation/SyncUpDetailNavigation-01-code-0002.swift @@ -4,7 +4,7 @@ import SwiftUI @Reducer struct App { @ObservableState - struct State { + struct State: Equatable { var syncUpsList = SyncUpsList.State() } enum Action { diff --git a/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/07-SyncUpDetailNavigation/SyncUpDetailNavigation-01-code-0003.swift b/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/07-SyncUpDetailNavigation/SyncUpDetailNavigation-01-code-0003.swift index 4337bd7ba44a..e41cefed80c7 100644 --- a/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/07-SyncUpDetailNavigation/SyncUpDetailNavigation-01-code-0003.swift +++ b/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/07-SyncUpDetailNavigation/SyncUpDetailNavigation-01-code-0003.swift @@ -4,7 +4,7 @@ import SwiftUI @Reducer struct App { @ObservableState - struct State { + struct State: Equatable { var path = StackState() var syncUpsList = SyncUpsList.State() } diff --git a/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/07-SyncUpDetailNavigation/SyncUpDetailNavigation-01-code-0004.swift b/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/07-SyncUpDetailNavigation/SyncUpDetailNavigation-01-code-0004.swift index 69c2389cffc8..adc860b69739 100644 --- a/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/07-SyncUpDetailNavigation/SyncUpDetailNavigation-01-code-0004.swift +++ b/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/07-SyncUpDetailNavigation/SyncUpDetailNavigation-01-code-0004.swift @@ -7,7 +7,7 @@ struct App { enum Path { } @ObservableState - struct State { + struct State: Equatable { var path = StackState() var syncUpsList = SyncUpsList.State() } diff --git a/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/07-SyncUpDetailNavigation/SyncUpDetailNavigation-01-code-0005.swift b/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/07-SyncUpDetailNavigation/SyncUpDetailNavigation-01-code-0005.swift index 00bd9f6e8db9..46829e3ac4b4 100644 --- a/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/07-SyncUpDetailNavigation/SyncUpDetailNavigation-01-code-0005.swift +++ b/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/07-SyncUpDetailNavigation/SyncUpDetailNavigation-01-code-0005.swift @@ -8,7 +8,7 @@ struct App { case detail(SyncUpDetail) } @ObservableState - struct State { + struct State: Equatable { var path = StackState() var syncUpsList = SyncUpsList.State() } diff --git a/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/07-SyncUpDetailNavigation/SyncUpDetailNavigation-01-code-0006.swift b/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/07-SyncUpDetailNavigation/SyncUpDetailNavigation-01-code-0006.swift index 9bf30f128d13..0674e1a33eaf 100644 --- a/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/07-SyncUpDetailNavigation/SyncUpDetailNavigation-01-code-0006.swift +++ b/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/07-SyncUpDetailNavigation/SyncUpDetailNavigation-01-code-0006.swift @@ -8,7 +8,7 @@ struct App { case detail(SyncUpDetail) } @ObservableState - struct State { + struct State: Equatable { var path = StackState() var syncUpsList = SyncUpsList.State() } diff --git a/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/07-SyncUpDetailNavigation/SyncUpDetailNavigation-01-code-0007.swift b/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/07-SyncUpDetailNavigation/SyncUpDetailNavigation-01-code-0007.swift index d9cfef9e8dc3..cb877d26cddd 100644 --- a/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/07-SyncUpDetailNavigation/SyncUpDetailNavigation-01-code-0007.swift +++ b/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/07-SyncUpDetailNavigation/SyncUpDetailNavigation-01-code-0007.swift @@ -8,7 +8,7 @@ struct App { case detail(SyncUpDetail) } @ObservableState - struct State { + struct State: Equatable { var path = StackState() var syncUpsList = SyncUpsList.State() } diff --git a/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/07-SyncUpDetailNavigation/SyncUpDetailNavigation-01-code-0008.swift b/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/07-SyncUpDetailNavigation/SyncUpDetailNavigation-01-code-0008.swift index 49c32b169b65..07cbda80fc18 100644 --- a/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/07-SyncUpDetailNavigation/SyncUpDetailNavigation-01-code-0008.swift +++ b/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/07-SyncUpDetailNavigation/SyncUpDetailNavigation-01-code-0008.swift @@ -8,7 +8,7 @@ struct App { case detail(SyncUpDetail) } @ObservableState - struct State { + struct State: Equatable { var path = StackState() var syncUpsList = SyncUpsList.State() } diff --git a/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/08-RecordMeeting/RecordMeetingFeature-02-code-0003-previous.swift b/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/08-RecordMeeting/RecordMeetingFeature-02-code-0003-previous.swift index a34fa2c2f89a..aca3d30e5175 100644 --- a/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/08-RecordMeeting/RecordMeetingFeature-02-code-0003-previous.swift +++ b/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/08-RecordMeeting/RecordMeetingFeature-02-code-0003-previous.swift @@ -71,6 +71,7 @@ struct SyncUpDetailView: View { .frame(maxWidth: .infinity) } } + .navigationTitle(Text(store.syncUp.title)) .toolbar { Button("Edit") { store.send(.editButtonTapped) diff --git a/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/08-RecordMeeting/RecordMeetingFeature-02-code-0003.swift b/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/08-RecordMeeting/RecordMeetingFeature-02-code-0003.swift index d789bbbb913e..83501db27d97 100644 --- a/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/08-RecordMeeting/RecordMeetingFeature-02-code-0003.swift +++ b/Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/08-RecordMeeting/RecordMeetingFeature-02-code-0003.swift @@ -72,6 +72,7 @@ struct SyncUpDetailView: View { .frame(maxWidth: .infinity) } } + .navigationTitle(Text(store.syncUp.title)) .toolbar { Button("Edit") { store.send(.editButtonTapped)