Order the steps
Put these steps of a Combine pipeline in order.
- Start from a publisher, such as
$queryorNotificationCenter.default.publisher(for:) - Apply operators, such as
map,filteranddebounce - Store the AnyCancellable so the subscription stays alive
- Subscribe with
sinkorassign
Hint 1 of 1
Nothing runs until there is a subscriber.
Choose an answer, then open Show answer below to check it.
Show answer
Answer: A B D C
- Start from a publisher, such as
$queryorNotificationCenter.default.publisher(for:)Every pipeline begins with a source of values. - Apply operators, such as
map,filteranddebounceEach operator wraps the upstream and returns a new publisher. - Subscribe with
sinkorassignSubscribing creates the subscription and starts the flow. - Store the AnyCancellable so the subscription stays alive Dropping it cancels the subscription.