Everyone needs a good editor..!!!✂️
Since iOS 8, Apple has provided us with the provision to add our own customized actions to a U_ITableView’s_ rows using the U_ITableViewDelegate_ method — t_ableView(_:editActionsForRowAt:)._
tableView(_:editActionsForRowAt:)
Asks the delegate for the actions to display in response to a swipe in the specified row.
Use this method when you want to provide custom actions for one of your table rows. When the user swipes horizontally in a row, the table view moves the row content aside to reveal your actions. Tapping one of the action buttons executes the handler block stored with the action object.
Now that iOS 11 is here, we have some new additions 🤓 to the table view’s editing API. Let’s see what’s in it for us.👀
With the release of iOS 11, Apple introduced two new methods 😮 for handling Swipe Actions in UITableView to support swipe actions on both leading as well as trailing edge of the row, i.e.
These methods were introduced as a part of UITableViewDelegate.
The methods to handle swipe actions in iOS 11 are optional 😅, i.e.
In iOS 11, swipe actions appear as Full Swipe by default 🤔, i.e the swipe spans the complete width of the UITableView.
The Full Swipe behaviour can be configured using performsFirstActionWithFullSwipe property 👏, introduced as a part of UISwipeActionsConfiguration — The set of actions to perform when swiping on rows of a table.
When this property is set to true, a full swipe in the row performs the first action listed in the actions property. The default value of this property is true.
Don’t forget to read my other articles:
Feel free to leave comments if you have any doubts. 🙂🙃