Любой вызов insert/delete/move ячеек, должен происходит между
beginUpdates
and
endUpdates
.
Сейчас Apple рекомендует использовать новый API,
Тут все описано:
func performBatchUpdates(_ updates: (() ->
Void)?, completion: ((
Bool) ->
Void)? = nil)
The block that performs the relevant insert, delete, reload, or move operations. In addition to modifying the table's rows, update your table's data source to reflect your changes. This block has no return value and takes no parameters.
для delete тоже самое.
https://stackoverflow.com/questions/31870206/how-to-insert-new-cell-into-uitableview-in-swift