Can multiple view controllers use a single uicollectionviewcell? = Yes, but

app has been pushed to GitHub (sorry, I forgot to remove the breakpoints)

Oh, I have just been playing with breakpoints, and you need to select FI’S FABULOUS FUDGE.
:thinking: thinking if the hard coded index is actually the root cause…?

I may have found a related problem. not sure it will fix the original issue

Where are you hard coding the index?

I hadn’t filled out the Add the UICollectionViewDelegate, didSelectItemAt. I have now, and I am back to the Index out of range error.

I have removed the hardcoded index, which I gather was causing the issue. HOWEVER, the Index out of bounds for
let recipe = recipes[indexPath.row]
at the breakpoint is where the problem is. I have pushed latest app in GitHub. I am going to take a break now… my head is tired.

I have followed the pattern from the original cookbook app, but in the new app, it crashes once the chapter image in the Collection View, and segue commences. It is in the UITableViewDataSource when it does Get recipe that the tableview is trying to display.
I have just updated the data file to have at least 1 placeholder recipe (rather than an empty array), and at the breakpoint, the app progressed. But when I checked the breakpoint despite me tapping AFTER DINNER, the ‘po recipe’ was the CHOOK PLACEHOLDER from POULTRY. So the issue must be setting the correct selectedChapterIndex, and then not having the correct recipieIndex range, as ‘po selectedChapterIndex’ returns 0 (instead of 2)

I think my issue lies in a TODO item in the ContentsViewController

// TO DO: Figure out how to didSelectItemAt for Collection View

Thank you for offering to help. As the problem does not related to the issue originally posted, I am going to close this item. Cheers.

1 Like

hi David, I have the same problem. Can you help me? https://github.com/vanhnganha/TodoList
I wonder if I can know your email/facebook…? I wanna ask you something. Thank you very much <3