You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+17-11Lines changed: 17 additions & 11 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -64,14 +64,14 @@ struct Counter: Dripper {
64
64
```
65
65
66
66
> [!NOTE]
67
-
> `State` class should be annotated with `@unchecked Sendable` to suppress the compiler error.\
68
-
> This is because `State` actually cannot be `Sendable` standalone.\
69
-
> However, while using `State` within `Station`, it's guaranteed to be thread-safe because it is managed by actor called `StateHandler`.
67
+
> You need to add `@unchecked Sendable` to the `State` class to suppress compiler errors.
68
+
> While `State` itself is actually not thread-safe, when used within `Station`, it is guaranteed to be thread-safe since it's managed by the `StateHandler` actor.
70
69
>
71
-
> We'll find some workaround for this in the future.
70
+
> We'll implement a better solution for this in a future update.
71
+
> Also, feel free to suggest any improvements on this issue! 😊
72
72
73
73
### Station
74
-
In SwiftUI view, you can use `Dripper`by using `Station`that uses`Dripper` as its Generic type.
74
+
To use `Dripper`in your SwiftUI views, create a `Station`instance with`Dripper` as its generic type parameter.
75
75
76
76
```swift
77
77
importSwiftUI
@@ -92,13 +92,15 @@ struct ContentView: View {
92
92
}
93
93
)
94
94
}
95
+
```
95
96
96
-
You can trigger `Action` with `pour` method, and you can observe the state with just accessing the property of `station`.
97
+
You can trigger `Action`using the `pour` method and directly access state through the `Station` properties.
97
98
98
99
### Effects
99
100
100
-
You can use `Effect` to handle side-effects like async operation.\
101
-
Actually, `.none` you saw in the `Dripper` section is one of `Effect` which is meaning there's no side-effect.
101
+
`Effect` helps you handle side-effects such as asynchronous operations.\
102
+
Remember the `.none` we saw in the `Dripper` example?\
103
+
Actually, that's one of `Effect` that indicates no side-effects will occur.
102
104
103
105
Here's an example of how to use `Effect`:
104
106
@@ -125,6 +127,10 @@ var body: some Dripper<State, Action> {
125
127
}
126
128
```
127
129
128
-
You can use `.run` to handle side-effect.\
129
-
It takes a closure that takes `pour` as an argument.\
130
-
You can trigger another action by calling `pour` inside the closure.
130
+
To handle side-effects, use `.run` with a closure that receives a `pour` function.\
131
+
Inside this closure, you can trigger additional actions by calling `pour` with desired `Action` as parameter.
132
+
133
+
---
134
+
Thanks for checking out Dripper! Questions and contributions are always welcome 😊
135
+
136
+
MIT license - [LICENSE](https://github.com/musicspot24/Dripper?tab=MIT-1-ov-file#)
0 commit comments