Skip to content

Fix regression: SyncUpDetailNavigation tutorial step 03-code-0004 drops the Array(...) wrapper from step 03-code-0003 - #3962

Open
carlosypunto wants to merge 1 commit into
pointfreeco:mainfrom
carlosypunto:fix/fix-regresion-in-a-step-of-tutorial
Open

carlosypunto wants to merge 1 commit into
pointfreeco:mainfrom
carlosypunto:fix/fix-regresion-in-a-step-of-tutorial

Conversation

@carlosypunto

Copy link
Copy Markdown

What's wrong

In the "Meet the Composable Architecture" → "Building SyncUps" → SyncUpDetailNavigation tutorial (section 3, SyncUpsList.swift), step 03-code-0003 correctly introduces:

ForEach(Array(store.$syncUps)) { $syncUp in

with an explicit callout explaining why the Array initializer is needed to pass the shared collection along to ForEach.

The very next step, 03-code-0004, is documented as only replacing the <#Shared<SyncUp>#> placeholder with $syncUp inside SyncUpDetail.State(syncUp: ...). However, the code file for that step also silently reverts the ForEach line back to:

ForEach(store.$syncUps) { $syncUp in

i.e. it drops the Array(...) wrapper that was just introduced and explained one step earlier — with no mention of this change in the step's instructions.

Why this is a regression, not intentional

  • The step 03-code-0004 instructions ("Pass the projected value $syncUp to SyncUpDetail.State") say nothing about touching the ForEach call.
  • The reference implementation in Examples/SyncUps/SyncUps/SyncUpsList.swift uses ForEach(Array(store.$syncUps)), confirming this is the intended final form.
  • Following the tutorial in order, a reader hits the exact same problem step 03-code-0003 had just fixed, right after fixing it — attached screenshots show the steps leading up to this.

Fix

Restore Array(...) in SyncUpDetailNavigation-03-code-0004.swift so it matches step 03-code-0003 plus the placeholder replacement, consistent with the reference app.

Screenshots

1. Step 03-code-0002 — baseline, before the Array fix
01 SyncUpDetailNavigation-03-code-0002 swift

2. Step 03-code-0003 — the fix: Array(...) is introduced
02 SyncUpDetailNavigation-03-code-0003 swift

3. Step 03-code-0004 — the regression: Array(...) is dropped again
03 SyncUpDetailNavigation-03-code-0004 swift

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant