heckj / swiftui-notes

content for Using Combine - notes on learning Combine with UIKit and SwiftUI
https://heckj.github.io/swiftui-notes/
MIT License
1.98k stars 205 forks source link

missing code in Sequencing asynchronous operations #260

Closed MiaShopgal closed 11 months ago

MiaShopgal commented 11 months ago

in the section for Sequencing asynchronous operations

There are only explanations for this subject, I don't see codes for it.

An example of this sequencing follows below. In this example, buttons (arranged visually to show the ordering of actions) are highlighted when they complete. The whole sequence is triggered by a separate button action, which also resets the state of all the buttons and cancels any existing running sequence if it’s not yet finished. In this example, the asynchronous API call is a call that simply takes a random amount of time to complete to provide an example of how the timing works.

I suppose there should be a code snippet right here

The workflow that is created is represented in steps:

step 1 runs first.

step 2 has three parallel efforts, running after step 1 completes.

step 3 waits to start until all three elements of step 2 complete.

step 4 runs after step 3 has completed.

image

MiaShopgal commented 11 months ago

I just realized these steps were referring to the buttons.