Skip to content

Commit 9f0c855

Browse files
committed
✨ Apply changes to example project
1 parent a30ed9e commit 9f0c855

1 file changed

Lines changed: 7 additions & 5 deletions

File tree

Examples/Counter/Counter/Counter.swift

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,9 @@ struct Counter: Dripper {
1616

1717
// MARK: Nested Types
1818

19+
@MainActor
1920
@Observable
20-
final class State {
21+
final class State: Sendable {
2122
var counter: Int = .zero
2223
var text = ""
2324
}
@@ -41,14 +42,15 @@ struct Counter: Dripper {
4142
case .resetCounter:
4243
state.counter = .zero
4344
case .randomNumber:
44-
return .run { _ in
45+
return .run { pour in
4546
func randomNumber() async throws -> Int {
4647
try await Task.sleep(for: .seconds(1))
47-
return Int.random(in: 0...10)
48+
return Int.random(in: 1...100)
4849
}
50+
4951
let randomNumber = try await randomNumber()
50-
// FIXME: Data Race
51-
// await pour(.decreaseCounter)
52+
53+
pour(.decreaseCounter)
5254
state.counter = randomNumber
5355
}
5456
}

0 commit comments

Comments
 (0)