RowAction
public class RowAction
Higher-API class for UIContextualAction
**Example Usage**
- Create Action
````
var rowAction: RowAction {
RowAction { [weak self] in
guard let `self` = self else { return }
let alertController = self.alertControllerExample
let act = self.dismissAction(for: alertController)
alertController.addAction(act)
self.present(alertController, animated: true, completion: nil)
}
}
````
- set up title and color
````
var leadingActions: [RowAction] {
let action = rowAction
action.backgroundColor = .green
action.title = "Done"
return [action]
}
````
- add to a row
````
let model = StringCellModel(uniqueID: ID, text: title)
let row = TableViewRow<StringCell>(model: model,
onTap: { debugPrint("tapped with \($0)")})
row.addRowLeadingActions(leadingActions)
````
-
Title of the action
Declaration
Swift
public var title: String?
-
Background color
Declaration
Swift
public var backgroundColor: UIColor?
-
Image
Declaration
Swift
public var image: UIImage?
-
Constructor
Declaration
Swift
public init(action: @escaping () -> Void)
Parameters
action
Action that is performed on action tap