Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix BuildingSyncUps tutorial #3099

Merged
merged 3 commits into from
May 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@
}

@Step {
Go to SyncUpListsTests.swift and make a change to the `testAddSyncUp` test to make an
Go to SyncUpsListTests.swift and make a change to the `testAddSyncUp` test to make an
incorrect assertion.

@Code(name: "SyncUpsListTests.swift", file: PersistingSyncUps-02-code-0001.swift, previousFile: PersistingSyncUps-02-code-0001-previous.swift)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ struct AppView: View {
} destination: { store in
switch store.case {
case let .detail(detailStore):
SyncUpDetail(store: detailStore)
SyncUpDetailView(store: detailStore)
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ struct RecordMeeting {
case .onAppear:
return .run { send in
while true {
try await Task.sleep(for: seconds(1))
try await Task.sleep(for: .seconds(1))
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ struct RecordMeeting {
case .onAppear:
return .run { send in
while true {
try await Task.sleep(for: seconds(1))
try await Task.sleep(for: .seconds(1))
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ struct RecordMeeting {
case .onAppear:
return .run { send in
while true {
try await Task.sleep(for: seconds(1))
try await Task.sleep(for: .seconds(1))
await send(.timerTick)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ struct RecordMeeting {
case .onAppear:
return .run { send in
while true {
try await Task.sleep(for: seconds(1))
try await Task.sleep(for: .seconds(1))
await send(.timerTick)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ struct RecordMeeting {
case .onAppear:
return .run { send in
while true {
try await Task.sleep(for: seconds(1))
try await Task.sleep(for: .seconds(1))
await send(.timerTick)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ struct RecordMeeting {
case .onAppear:
return .run { send in
while true {
try await Task.sleep(for: seconds(1))
try await Task.sleep(for: .seconds(1))
await send(.timerTick)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ struct RecordMeeting {
case .onAppear:
return .run { send in
while true {
try await Task.sleep(for: seconds(1))
try await Task.sleep(for: .seconds(1))
await send(.timerTick)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ struct RecordMeeting {
case .onAppear:
return .run { send in
while true {
try await Task.sleep(for: seconds(1))
try await Task.sleep(for: .seconds(1))
await send(.timerTick)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ struct RecordMeeting {
case .onAppear:
return .run { send in
while true {
try await Task.sleep(for: seconds(1))
try await Task.sleep(for: .seconds(1))
await send(.timerTick)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ struct RecordMeeting {
case .onAppear:
return .run { send in
while true {
try await Task.sleep(for: seconds(1))
try await Task.sleep(for: .seconds(1))
await send(.timerTick)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ struct RecordMeeting {
case .onAppear:
return .run { send in
while true {
try await Task.sleep(for: seconds(1))
try await Task.sleep(for: .seconds(1))
await send(.timerTick)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ struct RecordMeeting {
if state.secondsElapsed.isMultiple(of: secondsPerAttendee) {
if state.secondsElapsed == state.syncUp.duration.components.seconds {
state.syncUp.meetings.insert(
Meeting(id: uuid(), date: now, transcript: transcript),
Meeting(id: uuid(), date: now, transcript: state.transcript),
at: 0
)
return .run { _ in await dismiss() }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ struct RecordMeeting {
if state.secondsElapsed.isMultiple(of: secondsPerAttendee) {
if state.secondsElapsed == state.syncUp.duration.components.seconds {
state.syncUp.meetings.insert(
Meeting(id: uuid(), date: now, transcript: transcript),
Meeting(id: uuid(), date: now, transcript: state.transcript),
at: 0
)
return .run { _ in await dismiss() }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ struct RecordMeeting {
if state.secondsElapsed.isMultiple(of: secondsPerAttendee) {
if state.secondsElapsed == state.syncUp.duration.components.seconds {
state.syncUp.meetings.insert(
Meeting(id: uuid(), date: now, transcript: transcript),
Meeting(id: uuid(), date: now, transcript: state.transcript),
at: 0
)
return .run { _ in await dismiss() }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ struct RecordMeeting {
if state.secondsElapsed.isMultiple(of: secondsPerAttendee) {
if state.secondsElapsed == state.syncUp.duration.components.seconds {
state.syncUp.meetings.insert(
Meeting(id: uuid(), date: now, transcript: transcript),
Meeting(id: uuid(), date: now, transcript: state.transcript),
at: 0
)
return .run { _ in await dismiss() }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ struct RecordMeeting {
if state.secondsElapsed.isMultiple(of: secondsPerAttendee) {
if state.secondsElapsed == state.syncUp.duration.components.seconds {
state.syncUp.meetings.insert(
Meeting(id: uuid(), date: now, transcript: transcript),
Meeting(id: uuid(), date: now, transcript: state.transcript),
at: 0
)
return .run { _ in await dismiss() }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ struct RecordMeeting {
if state.secondsElapsed.isMultiple(of: secondsPerAttendee) {
if state.secondsElapsed == state.syncUp.duration.components.seconds {
state.syncUp.meetings.insert(
Meeting(id: uuid(), date: now, transcript: transcript),
Meeting(id: uuid(), date: now, transcript: state.transcript),
at: 0
)
return .run { _ in await dismiss() }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,12 @@ struct RecordMeeting {
var body: some ReducerOf<Self> {
Reduce { state, action in
switch action {
case .alert(.presented(.confirmDiscard)):
case .alert(.presented(.discardMeeting)):
return .run { _ in await dismiss() }

case .alert(.presented(.confirmSave)):
case .alert(.presented(.saveMeeting)):
state.syncUp.meetings.insert(
Meeting(id: uuid(), date: now, transcript: transcript),
Meeting(id: uuid(), date: now, transcript: state.transcript),
at: 0
)
return .run { _ in await dismiss() }
Expand Down Expand Up @@ -76,7 +76,7 @@ struct RecordMeeting {
if state.secondsElapsed.isMultiple(of: secondsPerAttendee) {
if state.secondsElapsed == state.syncUp.duration.components.seconds {
state.syncUp.meetings.insert(
Meeting(id: uuid(), date: now, transcript: transcript),
Meeting(id: uuid(), date: now, transcript: state.transcript),
at: 0
)
return .run { _ in await dismiss() }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,12 @@ struct RecordMeeting {
var body: some ReducerOf<Self> {
Reduce { state, action in
switch action {
case .alert(.presented(.confirmDiscard)):
case .alert(.presented(.discardMeeting)):
return .run { _ in await dismiss() }

case .alert(.presented(.confirmSave)):
case .alert(.presented(.saveMeeting)):
state.syncUp.meetings.insert(
Meeting(id: uuid(), date: now, transcript: transcript),
Meeting(id: uuid(), date: now, transcript: state.transcript),
at: 0
)
return .run { _ in await dismiss() }
Expand Down Expand Up @@ -79,7 +79,7 @@ struct RecordMeeting {
if state.secondsElapsed.isMultiple(of: secondsPerAttendee) {
if state.secondsElapsed == state.syncUp.duration.components.seconds {
state.syncUp.meetings.insert(
Meeting(id: uuid(), date: now, transcript: transcript),
Meeting(id: uuid(), date: now, transcript: state.transcript),
at: 0
)
return .run { _ in await dismiss() }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ final class RecordMeetingTests: XCTestCase {
Attendee(id: Attendee.ID(), name: "Blob"),
Attendee(id: Attendee.ID(), name: "Blob Jr"),
],
duration: .duration(4),
duration: .seconds(4),
title: "Morning Sync"
)
let store = TestStore(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ final class RecordMeetingTests: XCTestCase {
Attendee(id: Attendee.ID(), name: "Blob"),
Attendee(id: Attendee.ID(), name: "Blob Jr"),
],
duration: .duration(4),
duration: .seconds(4),
title: "Morning Sync"
)
let store = TestStore(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ final class RecordMeetingTests: XCTestCase {
Attendee(id: Attendee.ID(), name: "Blob"),
Attendee(id: Attendee.ID(), name: "Blob Jr"),
],
duration: .duration(4),
duration: .seconds(4),
title: "Morning Sync"
)
let store = TestStore(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ final class RecordMeetingTests: XCTestCase {
Attendee(id: Attendee.ID(), name: "Blob"),
Attendee(id: Attendee.ID(), name: "Blob Jr"),
],
duration: .duration(4),
duration: .seconds(4),
title: "Morning Sync"
)
let store = TestStore(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ final class RecordMeetingTests: XCTestCase {
Attendee(id: Attendee.ID(), name: "Blob"),
Attendee(id: Attendee.ID(), name: "Blob Jr"),
],
duration: .duration(4),
duration: .seconds(4),
title: "Morning Sync"
)
let store = TestStore(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ final class RecordMeetingTests: XCTestCase {
Attendee(id: Attendee.ID(), name: "Blob"),
Attendee(id: Attendee.ID(), name: "Blob Jr"),
],
duration: .duration(4),
duration: .seconds(4),
title: "Morning Sync"
)
let store = TestStore(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ final class RecordMeetingTests: XCTestCase {
Attendee(id: Attendee.ID(), name: "Blob"),
Attendee(id: Attendee.ID(), name: "Blob Jr"),
],
duration: .duration(4),
duration: .seconds(4),
title: "Morning Sync"
)
let store = TestStore(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ final class RecordMeetingTests: XCTestCase {
Attendee(id: Attendee.ID(), name: "Blob"),
Attendee(id: Attendee.ID(), name: "Blob Jr"),
],
duration: .duration(4),
duration: .seconds(4),
title: "Morning Sync"
)
let store = TestStore(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ final class RecordMeetingTests: XCTestCase {
Attendee(id: Attendee.ID(), name: "Blob"),
Attendee(id: Attendee.ID(), name: "Blob Jr"),
],
duration: .duration(4),
duration: .seconds(4),
title: "Morning Sync"
)
let store = TestStore(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ final class RecordMeetingTests: XCTestCase {
Attendee(id: Attendee.ID(), name: "Blob"),
Attendee(id: Attendee.ID(), name: "Blob Jr"),
],
duration: .duration(4),
duration: .seconds(4),
title: "Morning Sync"
)
let store = TestStore(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ final class RecordMeetingTests: XCTestCase {
Attendee(id: Attendee.ID(), name: "Blob"),
Attendee(id: Attendee.ID(), name: "Blob Jr"),
],
duration: .duration(4),
duration: .seconds(4),
title: "Morning Sync"
)
let store = TestStore(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ final class RecordMeetingTests: XCTestCase {
Attendee(id: Attendee.ID(), name: "Blob"),
Attendee(id: Attendee.ID(), name: "Blob Jr"),
],
duration: .duration(4),
duration: .seconds(4),
title: "Morning Sync"
)
let store = TestStore(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ final class RecordMeetingTests: XCTestCase {
Attendee(id: Attendee.ID(), name: "Blob"),
Attendee(id: Attendee.ID(), name: "Blob Jr"),
],
duration: .duration(4),
duration: .seconds(4),
title: "Morning Sync"
)
let store = TestStore(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ final class RecordMeetingTests: XCTestCase {
Attendee(id: Attendee.ID(), name: "Blob"),
Attendee(id: Attendee.ID(), name: "Blob Jr"),
],
duration: .duration(4),
duration: .seconds(4),
title: "Morning Sync"
)
let store = TestStore(
Expand All @@ -26,7 +26,7 @@ final class RecordMeetingTests: XCTestCase {
$0.uuid = .incrementing
}

await store.send(.onAppear)
let onAppearTask = await store.send(.onAppear)
await clock.advance(by: .seconds(1))
await store.receive(\.timerTick) {
$0.secondsElapsed = 1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ final class RecordMeetingTests: XCTestCase {
Attendee(id: Attendee.ID(), name: "Blob"),
Attendee(id: Attendee.ID(), name: "Blob Jr"),
],
duration: .duration(4),
duration: .seconds(4),
title: "Morning Sync"
)
let store = TestStore(
Expand All @@ -26,7 +26,7 @@ final class RecordMeetingTests: XCTestCase {
$0.uuid = .incrementing
}

await store.send(.onAppear)
let onAppearTask = await store.send(.onAppear)
await clock.advance(by: .seconds(1))
await store.receive(\.timerTick) {
$0.secondsElapsed = 1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ final class RecordMeetingTests: XCTestCase {
Attendee(id: Attendee.ID(), name: "Blob"),
Attendee(id: Attendee.ID(), name: "Blob Jr"),
],
duration: .duration(4),
duration: .seconds(4),
title: "Morning Sync"
)
let store = TestStore(
Expand All @@ -26,9 +26,10 @@ final class RecordMeetingTests: XCTestCase {
$0.continuousClock = clock
$0.date.now = Date(timeIntervalSince1970: 1234567890)
$0.uuid = .incrementing
$0.dismiss = DismissEffect { dismissed.fulfill() }
}

await store.send(.onAppear)
let onAppearTask = await store.send(.onAppear)
await clock.advance(by: .seconds(1))
await store.receive(\.timerTick) {
$0.secondsElapsed = 1
Expand Down
Loading