Home > Back-end >  When deleting an entry in my array of arrays, the program crashes in swift
When deleting an entry in my array of arrays, the program crashes in swift

Time:04-01

I have a program that sorts/displays emojis in different category's. This program has an edit button where the user should be able to delete or move an "entry" then when they click done the program re-adjusts. The array(s) should update and so should the running totals at the bottom of each section.

I'm not sure where the problem lies. The error message is:

"Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Invalid update: invalid number of sections. The number of sections contained in the table view after the update (3) must be equal to the number of sections contained in the table view before the update (4), plus or minus the number of sections inserted or deleted (0 inserted, 0 deleted)."

Current Code:

 import UIKit

class EmojiTableViewController: UITableViewController {

    var emojis: [[Emoji]] = [
            
            [Emoji(symbol: "           
  • Related