Skip to content

Commit

Permalink
Update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
raptorxcz committed Apr 10, 2024
1 parent 73296ab commit c4630dc
Showing 1 changed file with 24 additions and 10 deletions.
34 changes: 24 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,25 +11,39 @@ We've found [CQRS](https://martinfowler.com/bliki/CQRS.html) to be extremely hel

## Usage

### Create pipeline

```swift
class Storage {
let pipeline = PublishingPipeline<Int>(value: 0)
}
```

### Getting value from pipeline

// Getting value from pipeline
let storage = Storage()
```swift
let value = await stoage.pipeline.value()
```

// Chaining operators
class Sample {
...

func getNewValue() -> any Pipeline<Int> {
return storage.pipeline.map { $0 + 42 }
}
### Mapping value

```swift
func getNewValue() -> any Pipeline<Int> {
return storage.pipeline.map { $0 + 42 }
}
```

### Merging multiple pipelines

```swift
func getNewValue() -> any Pipeline<Int> {
return storage.pipeline.merge(with: anotherPipeline) { $0 + $1 + 42 }
}
```

// Sinking values
### Sinking values and storing pipeline

```swift
class Sample {
private var runningPipelines = [SinkedPipeline]()
...
Expand Down

0 comments on commit c4630dc

Please sign in to comment.