https://speakerdeck.com/shiz/sorosorocombine
-
“Declarative API for handling various types of asynchronous processing in a single method”
- Various types: delegate, closure, etc..
- All of these become Publishers
- Declarative: Specify only the purpose?
- Various types: delegate, closure, etc..
-
One of the advantages of Combine is that it can be optimized internally.
-
Publisher<Output, Failure: Error>
- Continues to emit values: Output until Completion (either finished or failure) occurs.
-
Subscriber<Input, Failure: Error>
- Receives values from the Publisher (Input and Output, Failure and Failure values must be the same)
- Receiver-driven, the Subscriber only receives the necessary amount of values (known as BackPressure)
- Adjusts demand
-
Subscription
- Mediates between Publisher and Subscriber
- Cancellable
- AnyCancellable: Automatically cancels when released from memory
- Useful for cases like removing previous processes during screen transitions #iOSDC2020
- AnyCancellable: Automatically cancels when released from memory