Add performsFirstActionWithFullSwipe
This commit is contained in:
parent
94c40faa63
commit
efc03d7c22
|
|
@ -355,13 +355,23 @@ open class TableDirector: NSObject, UITableViewDataSource, UITableViewDelegate {
|
|||
@available(iOS 11, *)
|
||||
open func tableView(_ tableView: UITableView,
|
||||
leadingSwipeActionsConfigurationForRowAt indexPath: IndexPath) -> UISwipeActionsConfiguration? {
|
||||
return .init(actions: sections[indexPath.section].rows[indexPath.row].leadingContextualActions)
|
||||
let currentRow = sections[indexPath.section].rows[indexPath.row]
|
||||
let configuration = UISwipeActionsConfiguration(actions: currentRow.leadingContextualActions)
|
||||
|
||||
configuration.performsFirstActionWithFullSwipe = currentRow.performsFirstActionWithFullSwipe
|
||||
|
||||
return configuration
|
||||
}
|
||||
|
||||
@available(iOS 11, *)
|
||||
open func tableView(_ tableView: UITableView,
|
||||
trailingSwipeActionsConfigurationForRowAt indexPath: IndexPath) -> UISwipeActionsConfiguration? {
|
||||
return .init(actions: sections[indexPath.section].rows[indexPath.row].trailingContextualActions)
|
||||
let currentRow = sections[indexPath.section].rows[indexPath.row]
|
||||
let configuration = UISwipeActionsConfiguration(actions: currentRow.trailingContextualActions)
|
||||
|
||||
configuration.performsFirstActionWithFullSwipe = currentRow.performsFirstActionWithFullSwipe
|
||||
|
||||
return configuration
|
||||
}
|
||||
|
||||
open func tableView(_ tableView: UITableView, editingStyleForRowAt indexPath: IndexPath) -> UITableViewCell.EditingStyle {
|
||||
|
|
|
|||
|
|
@ -44,6 +44,9 @@ public protocol RowActionable {
|
|||
@available(iOS 11, *)
|
||||
var trailingContextualActions: [UIContextualAction] { get }
|
||||
|
||||
@available(iOS 11, *)
|
||||
var performsFirstActionWithFullSwipe: Bool { get }
|
||||
|
||||
@available(iOS, obsoleted: 11, message: "Use leadingContextualActions, trailingContextualActions instead")
|
||||
var editingActions: [UITableViewRowAction]? { get }
|
||||
|
||||
|
|
|
|||
|
|
@ -38,6 +38,11 @@ open class TableRow<CellType: ConfigurableCell>: Row where CellType: UITableView
|
|||
[]
|
||||
}
|
||||
|
||||
@available(iOS 11, *)
|
||||
open var performsFirstActionWithFullSwipe: Bool {
|
||||
false
|
||||
}
|
||||
|
||||
open var hashValue: Int {
|
||||
return ObjectIdentifier(self).hashValue
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue