'Deleting and inserting a row in a table?
I am following some swift tutorials and I have been noticing that sometimes it's enough to use the array and append/remove but sometimes you have to also add insertrows/deleterows for the table to have the required result and i can't distinguish when and why
tasks.remove(at: indexPath.row)
table.deleteRows(at: [indexPath], with: .automatic)
Solution 1:[1]
Basically removing data from your data source will perform the deletion. In case of showing that deletion happened, you are using delete rows. which will show the delete animation and reload the data source.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Abdul Momen |