Beginning Table Views · Challenge: Edit View Controller Checklist | Ray Wenderlich


This is a companion discussion topic for the original entry at https://www.raywenderlich.com/5995-beginning-table-views/lessons/36

Hi, I’ve got a couple of questions. When you created the extension in ChecklistViewController, you called navigationController?.popViewController(). I thought this was weird since we had already popped that stack in the done and cancel methods of AddItemViewController.

Were we supposed to remove one of the popViewController calls?
If so, which one is the appropriate one to hang on to from a reuse perspective?

I ask because the app functions as expected with both calls and with one of the calls commented out (but not with both calls commented out, of course). I read that this is because we cannot pop the last view controller. That said, if we were several layers deep, would this double call have produced a bug by removing too many of the layers?

@bdmoakley Can you please help with this when you get a chance? Thank you - much appreciated! :]

Yes, in the previous Segue video comments, he said it was a bug that pop was in two places. I removed the one from the AITVC and left the one in the CLVC. I asked my Developer Lead at work where should the pop be happening. He said since you’re already delegating back to the CLVC, you might as well do the pop in there.

@hashmo Thank you for sharing this - much appreciated! :]

1 Like