Skip to content

Commit be997a6

Browse files
committed
📝 Update README.md
1 parent d6b4e72 commit be997a6

1 file changed

Lines changed: 17 additions & 11 deletions

File tree

README.md

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -64,14 +64,14 @@ struct Counter: Dripper {
6464
```
6565

6666
> [!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.
7069
>
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! 😊
7272
7373
### 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.
7575

7676
```swift
7777
import SwiftUI
@@ -92,13 +92,15 @@ struct ContentView: View {
9292
}
9393
)
9494
}
95+
```
9596

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.
9798

9899
### Effects
99100

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.
102104

103105
Here's an example of how to use `Effect`:
104106

@@ -125,6 +127,10 @@ var body: some Dripper<State, Action> {
125127
}
126128
```
127129

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

Comments
 (0)