mirror of
https://github.com/zhigang1992/ReactiveCocoa.git
synced 2026-04-29 04:45:24 +08:00
Side effects
This commit is contained in:
@@ -83,6 +83,29 @@ signal.observe(next: { next in
|
||||
|
||||
### Injecting effects
|
||||
|
||||
Side effects can be injected on a `SignalProducer` with the `on` operator without actually subscribing to it.
|
||||
|
||||
```Swift
|
||||
producer
|
||||
|> on(started: {
|
||||
println("Started")
|
||||
}, event: { event in
|
||||
println("Event: \(event)")
|
||||
}, error: { error in
|
||||
println("Error: \(error)")
|
||||
}, completed: { () -> () in
|
||||
println("Completed")
|
||||
}, interrupted: { () -> () in
|
||||
println("Interrupted")
|
||||
}, terminated: { () -> () in
|
||||
println("Terminated")
|
||||
}, disposed: { () -> () in
|
||||
println("Disposed")
|
||||
}, next: { next in
|
||||
println("Next: \(next)")
|
||||
})
|
||||
```
|
||||
|
||||
## Operator composition
|
||||
|
||||
### Pipe
|
||||
|
||||
Reference in New Issue
Block a user