Skip to content

SyncUps Tutorial: what am I doing wrong? #3224

Closed Answered by gbuela
gbuela asked this question in Q&A
Discussion options

You must be logged in to vote

So apparently the logic that adds an attendee when you remove the last one was missing dealing with focus. As it is in the tutorial, if the focus was on the removed attendee, it is not changed to the new one. That's why I had an expectation mismatch on the focus.

I fixed it like this:

            case let .onDeleteAttendees(indices):
                state.syncUp.attendees.remove(atOffsets: indices)
                guard
                    !state.syncUp.attendees.isEmpty,
                    let firstIndex = indices.first
                else {
                    let newAttendee = Attendee(id: uuid())
                    state.syncUp.attendees.append(
                        newAttendee
…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by gbuela
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant