pointfreeco/swift-composable-architecture

UUID creation not working as described in the SyncUps Tutorial

Closed this issue · 2 comments

Description

Description

In the 'New sync-up form' section, step 5 from the Testing the Sync-Up Form tutorial, there's a discrepancy between the code in the tutorial and the example project regarding the Attendee object instantiation using Tagged.
EDIT:
The same UUID creation discrepancy persists in subsequent sections.

Issues:

  • Reducer section:

    • Tutorial suggests: let attendee = Attendee(id: uuid()) which does not compile.
    • Example project uses: let attendee = Attendee(id: Attendee.ID(uuid())), which compiles successfully.
  • Test section:

    • Tutorial shows: let attendee = Attendee(id: Attendee.ID(0)), resulting in a compilation error.
    • Example project correction: let attendeeId = Attendee.ID(UUID(0)), compiles without issues.

Checklist

  • I have determined whether this bug is also reproducible in a vanilla SwiftUI project.
  • If possible, I've reproduced the issue using the main branch of this package.
  • This issue hasn't been addressed in an existing GitHub issue or discussion.

Expected behavior

The tutorial code should allow for the successful creation of an Attendee object using the provided syntax, ensuring consistency with the example project and compiling without errors.

Actual behavior

The code snippet from the tutorial let attendee = Attendee(id: uuid()) fails to compile. The tutorial's approach does not match the working example in the repository, which uses let attendee = Attendee(id: Attendee.ID(uuid())).

Steps to reproduce

No response

The Composable Architecture version information

1.10.3

Destination operating system

iOS 17.4

Xcode version information

Version 15.3 (15E204a)

Swift Compiler version information

swift-driver version: 1.90.11.1 Apple Swift version 5.10 (swiftlang-5.10.0.13 clang-1500.3.9.4)
Target: arm64-apple-macosx14.0

Hi @Blejator90, we should update the tutorial to be clearer, but the tagged discussion was just a side quest, and the rest of the tutorial assumes that we are not using tagged to keep things simple.

Hi @mbrandonw, that makes sense.

I noticed a similar issue in the tutorial for Editing and Deleting a Sync-Up, specifically in section 2 about deleting a sync-up. The tutorial instructs deleting the syncup inline and references an alternative (if it bothers the reader): sending a delegate action. Although step 13 does mention calling this delegate action, it's not illustrated in the examples. Subsequent sections also assume that the reader implemented the delegate action, which was not shown.