Silver Challenge - Right approach?

Hello! Did anyone complete the Silver Challenge without using a title for the footer? The exercise seems to be pretty clear in that it wants us to complete it using a cell with the text “No items!”, though. I’m pretty close to solving it and will post my solution once I am done, but I am wondering what’s the approach others are taking. The way I am doing it is by using a new section without a title (that either shows or hides the contentView in the only cell it has) which seems to be the reasonable way to proceed as this was supposed to build on what we learned in the Bronze Challenge? Or is there an easier way that someone else might have thought of? Any comments would be greatly appreciated!

My solution involved creating a “No items!” cell that gets deleted when a first real new item is created, and created when the last real item is deleted as well as initially on viewDidLoad. I added a method in ItemStore to create a No Items! item, and check for the name in the various ItemsViewController methods.

Note that I took this as a separate challenge from the Bronze challenge, meaning that I started with the single section that the chapter ended with, and not the two from Bronze. I don’t think doing it based on Bronze and two sections would be much more difficult.

The only issue I’m having is that while I can prevent it from being deleted, I haven’t figured out how to prevent the swipe to Delete from appearing when swiping. Swiping doesn’t delete, and I disabled the Edit button when it’s the only item, but I’d like to keep it from appearing to be swiped as well.

Found it. I had to implement tableView( _ tableView: UITableView, canEditRowAt indexPath: IndexPath) -> Bool to prevent the No items! item from being editable at all. It was easy once I found it. :slight_smile: