It seems like it should be easy to do, but how do I delete the item at the indexPath when the "X" button in the cell is tapped?
Do I create an IBAction in the Cell class? If so, how do I pass in the indexPath.item?
In some research I have done, I've seen people use notifications and observers, but it seems to be overcomplicated.
Can someone provide a basic solution for deleting a cell at the indexPath with a delete button?
I am using Realm to persist the items, but I'm having trouble knowing where to put the try! realm.write
and realm.delete(category)
code.
Thank you.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…