LAST CHANCE: Save 50% on all my Swift books and bundles! >>

iDine tutorial - Edit toolbar button stops working

Forums > SwiftUI


Hello, I followed the new set of videos Paul just posted. There seems to be some bug related to the Edit toolbar button when looking at an Order.

If I add some items to the order, then use the Edit button to delete them (as Paul does at - then switch back to the Menu tab and add a few more items, and go back to Order view. Then the Edit button seems to have no effect. It will switch to Done and back but no red delete icons appear.

Any ideas how to fix / what might be causing? Happy to post a video showing exact steps I'm taking if the above paragraph doesn't make sense.



Friendly bump, here is a video that demonstrates the Edit button stopping working after the first time it's used and the order is edited again.


I had a similar bug which was related to tagging on the tab item. I had not tagged all of my tabitems so whenever the UI was updated, it sent me to the untagged view. Is that something you are using?


Bold for a relative beginner like me to say it, but this looks like a SwiftUI bug. I also went through Paul's updated iDine tutorial, and I can reproduce the bug @geoff has reported. Just to be sure, I went ahead and added .tag()s to the tabItems in MainView per @recnats suggestion, but I did not observe any affect on the bug. The List in OrderView simply does not change into "red dot mode" on second and subsequent clicks of the Edit button.


Problem seems to be related more to switching views somehow since it's not necessary to delete items from an order to see it. I was able to reproduce the problem using the @twostraws version of iDine from GitHub by adding just two items. Using Xcode 14.2 to build, and running on an iOS 16.2 iPhone 14 Pro simulator:

  1. Run iDine in the simulator and tap on an item in Content View (menu)
  2. Tap the Order This button in the ItemDetail view
  3. Tap the Order tab and confirm one item in the list
  4. Tap Edit and confirm the the UI changes to allow deletions and then tap Done without deleting anything
  5. Tap the Menu tab, go back to the main page (menu) and select a 2nd different item and tap Order This
  6. Tap the Order tab and confirm 2nd item is now also in the list
  7. Tap the Edit button and note that the edit functionality is not behaving properly (list item UI does not change)

Could still very well be a SwiftUI bug as @geoff suggests.


Hello! I think I found a possible workaround here(with it's own negative effect btw): I tried to add id modifier to List in OrderView like this:


Negative effect I mentioned: no more smooth row deletion animation, because whole List redraws after order.items changed.


Hacking with Swift is sponsored by Essential Developer.

SPONSORED Join a FREE crash course for mid/senior iOS devs who want to achieve an expert level of technical and practical skills – it’s the fast track to being a complete senior developer! Hurry up because it'll be available only until July 28th.

Click to save your free spot now

Sponsor Hacking with Swift and reach the world's largest Swift community!

Archived topic

This topic has been closed due to inactivity, so you can't reply. Please create a new topic if you need to.

All interactions here are governed by our code of conduct.

Unknown user

You are not logged in

Log in or create account

Link copied to your pasteboard.