Skip to content

Commit 857ea3c

Browse files
[Building Sync-ups Tutorial] fixes in "Record meeting" chapter (pointfreeco#3582)
* refactor: remove unused preview and comments in tutorial * refactor: update foreground color to foreground style Change foregroundColor to foregroundStyle. Update the delete button to use a destructive role. * refactor: update foreground color to foreground style * refactor: use withLock for modifying shared syncUp and add missing Foundation import * discard the result of inserting a meeting to avoid compilation warning * refactor: update code to use withLock wherever needed * refactor(tests): update meeting insertion using withLock
1 parent 7953e49 commit 857ea3c

File tree

37 files changed

+214
-178
lines changed

37 files changed

+214
-178
lines changed

Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/08-RecordMeeting/ImplementingTimer-01-code-0001-previous.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ struct RecordMeetingView: View {
4848
}
4949
}
5050
.padding()
51-
.foregroundColor(store.syncUp.theme.accentColor)
51+
.foregroundStyle(store.syncUp.theme.accentColor)
5252
.navigationBarTitleDisplayMode(.inline)
5353
.toolbar {
5454
ToolbarItem(placement: .cancellationAction) {

Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/08-RecordMeeting/ImplementingTimer-01-code-0001.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ struct RecordMeetingView: View {
4949
}
5050
}
5151
.padding()
52-
.foregroundColor(store.syncUp.theme.accentColor)
52+
.foregroundStyle(store.syncUp.theme.accentColor)
5353
.navigationBarTitleDisplayMode(.inline)
5454
.toolbar {
5555
ToolbarItem(placement: .cancellationAction) {

Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/08-RecordMeeting/ImplementingTimer-01-code-0002.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ struct RecordMeetingView: View {
6464
}
6565
}
6666
.padding()
67-
.foregroundColor(store.syncUp.theme.accentColor)
67+
.foregroundStyle(store.syncUp.theme.accentColor)
6868
.navigationBarTitleDisplayMode(.inline)
6969
.toolbar {
7070
ToolbarItem(placement: .cancellationAction) {

Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/08-RecordMeeting/ImplementingTimer-01-code-0003.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ struct RecordMeetingView: View {
6565
}
6666
}
6767
.padding()
68-
.foregroundColor(store.syncUp.theme.accentColor)
68+
.foregroundStyle(store.syncUp.theme.accentColor)
6969
.navigationBarTitleDisplayMode(.inline)
7070
.toolbar {
7171
ToolbarItem(placement: .cancellationAction) {

Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/08-RecordMeeting/ImplementingTimer-01-code-0004.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ struct RecordMeetingView: View {
6868
}
6969
}
7070
.padding()
71-
.foregroundColor(store.syncUp.theme.accentColor)
71+
.foregroundStyle(store.syncUp.theme.accentColor)
7272
.navigationBarTitleDisplayMode(.inline)
7373
.toolbar {
7474
ToolbarItem(placement: .cancellationAction) {

Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/08-RecordMeeting/ImplementingTimer-01-code-0005.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ struct RecordMeetingView: View {
6969
}
7070
}
7171
.padding()
72-
.foregroundColor(store.syncUp.theme.accentColor)
72+
.foregroundStyle(store.syncUp.theme.accentColor)
7373
.navigationBarTitleDisplayMode(.inline)
7474
.toolbar {
7575
ToolbarItem(placement: .cancellationAction) {

Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/08-RecordMeeting/ImplementingTimer-01-code-0006.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ struct RecordMeetingView: View {
7373
}
7474
}
7575
.padding()
76-
.foregroundColor(store.syncUp.theme.accentColor)
76+
.foregroundStyle(store.syncUp.theme.accentColor)
7777
.navigationBarTitleDisplayMode(.inline)
7878
.toolbar {
7979
ToolbarItem(placement: .cancellationAction) {

Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/08-RecordMeeting/ImplementingTimer-01-code-0007.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ struct RecordMeetingView: View {
7474
}
7575
}
7676
.padding()
77-
.foregroundColor(store.syncUp.theme.accentColor)
77+
.foregroundStyle(store.syncUp.theme.accentColor)
7878
.navigationBarTitleDisplayMode(.inline)
7979
.toolbar {
8080
ToolbarItem(placement: .cancellationAction) {

Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/08-RecordMeeting/ImplementingTimer-01-code-0008.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ struct RecordMeetingView: View {
7878
}
7979
}
8080
.padding()
81-
.foregroundColor(store.syncUp.theme.accentColor)
81+
.foregroundStyle(store.syncUp.theme.accentColor)
8282
.navigationBarTitleDisplayMode(.inline)
8383
.toolbar {
8484
ToolbarItem(placement: .cancellationAction) {

Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/08-RecordMeeting/ImplementingTimer-01-code-0009.swift

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import ComposableArchitecture
2+
import Foundation
23

34
@Reducer
45
struct RecordMeeting {
@@ -43,10 +44,12 @@ struct RecordMeeting {
4344
let secondsPerAttendee = Int(state.syncUp.durationPerAttendee.components.seconds)
4445
if state.secondsElapsed.isMultiple(of: secondsPerAttendee) {
4546
if state.secondsElapsed == state.syncUp.duration.components.seconds {
46-
state.syncUp.meetings.insert(
47-
Meeting(id: Meeting.ID(), date: Date(), transcript: state.transcript),
48-
at: 0
49-
)
47+
state.$syncUp.withLock {
48+
_ = $0.meetings.insert(
49+
Meeting(id: Meeting.ID(), date: Date(), transcript: state.transcript),
50+
at: 0
51+
)
52+
}
5053
}
5154
state.speakerIndex += 1
5255
}
@@ -84,7 +87,7 @@ struct RecordMeetingView: View {
8487
}
8588
}
8689
.padding()
87-
.foregroundColor(store.syncUp.theme.accentColor)
90+
.foregroundStyle(store.syncUp.theme.accentColor)
8891
.navigationBarTitleDisplayMode(.inline)
8992
.toolbar {
9093
ToolbarItem(placement: .cancellationAction) {

0 commit comments

Comments
 (0)