Swiping on a tableview is deselecting all selected rows trailingSwipeActionsConfigurationForRowAt

Holy crap, I fixed this stupid issue.

Yes, yes make sure tableView.allowsSelectionDuringEditing = true and tableView.allowsMultipleSelectionDuringEditing = true.

But...

Shout-out to this SO answer which almost directly led me on the way to success (see here).

KEY: Re-select/de-select the rows in your implementation of setEditing, which is a method you override. UITableView goes into editing mode when swiping.

IMPORTANT NOTE: Call super.setEditing(...) before any of your code, as shown below, or it likely won't work, or at least not perfectly.

override func setEditing(_ editing: Bool, animated: Bool) {
    super.setEditing(editing, animated: animated)
    for i in 0..<your data.count {
        if this item is selected {
            self.tableView.selectRow(at: IndexPath(row: i, section: 0), animated: false, scrollPosition: .none)
        } else {
            self.tableView.deselectRow(at: IndexPath(row: i, section: 0), animated: false)
        }
    }
}

A swipe is considered as an edit, so you can enable allowsSelectionDuringEditing if you want to keep the selected state:

tableView.allowsSelectionDuringEditing = true