From 7ee77bd6b759f4abc75094c2571078c152a037cb Mon Sep 17 00:00:00 2001 From: Oliver Foggin Date: Fri, 15 Dec 2023 12:04:58 +0000 Subject: [PATCH] Update README.md --- README.md | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 3f987d8..2bbe577 100644 --- a/README.md +++ b/README.md @@ -33,7 +33,11 @@ If the `AsyncStream` `Element` type is the same as the input type of the respons Reduce { // your usual reducer here } -.subscribe(to: myDependency.stream, on: \.some.trigger.action, with: \.some.response.actionThatTakesStreamElement) +.subscribe( + to: myDependency.stream, + on: \.some.trigger.action, + with: \.some.response.actionThatTakesStreamElement +) ``` # If the type doesn't match @@ -44,7 +48,11 @@ If the stream `Element` type needs to be transformed you can do: Reduce { // your usual reducer here } -.subscribe(to: myDependency.stream, on: \.some.trigger.action, with: \.response.actionThatTakesAString) { streamElement in +.subscribe( + to: myDependency.stream, + on: \.some.trigger.action, + with: \.response.actionThatTakesAString +) { streamElement in // return some type created from the streamElement "\(streamElement)" } @@ -58,7 +66,10 @@ If you don't necessarily need a response action but you want to do something els Reduce { // your usual reducer here } -.subscribe(to: myDependency.stream, on: \.some.trigger.action) { send, streamElement in +.subscribe( + to: myDependency.stream, + on: \.some.trigger.action +) { send, streamElement in await send(.responseAction) await otherDependency.doSomethingElse(with: streamElement) }