diff --git a/README.md b/README.md index ba6671e..1ad049d 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ Build Status Swift 3.0 compatible Carthage compatible - CocoaPods compatible + CocoaPods compatible Platform iOS License: MIT

diff --git a/Sources/TableRow.swift b/Sources/TableRow.swift index 631768c..edfca6e 100644 --- a/Sources/TableRow.swift +++ b/Sources/TableRow.swift @@ -98,6 +98,12 @@ open class TableRow: Row where CellType: UITableView return on(TableRowAction(type, handler: handler)) } + + @discardableResult + open func on(_ key: String, handler: @escaping (_ options: TableRowActionOptions) -> ()) -> Self { + + return on(TableRowAction(.custom(key), handler: handler)) + } open func removeAllActions() { diff --git a/Sources/TableRowAction.swift b/Sources/TableRowAction.swift index 9ac7979..73c7419 100644 --- a/Sources/TableRowAction.swift +++ b/Sources/TableRowAction.swift @@ -76,8 +76,7 @@ open class TableRowAction where CellType: UITableVie self.handler = .action(handler) } - public func invokeActionOn(cell: UITableViewCell?, item: Any, path: IndexPath, userInfo: [AnyHashable: Any]?) -> Any? { - guard let item = item as? CellType.T else { return nil } + public func invokeActionOn(cell: UITableViewCell?, item: CellType.T, path: IndexPath, userInfo: [AnyHashable: Any]?) -> Any? { return handler.invoke(withOptions: TableRowActionOptions(item: item, cell: cell as? CellType, path: path, userInfo: userInfo)) } diff --git a/TableKit.podspec b/TableKit.podspec index 908f5b5..4cdd341 100644 --- a/TableKit.podspec +++ b/TableKit.podspec @@ -2,7 +2,7 @@ Pod::Spec.new do |s| s.name = 'TableKit' s.module_name = 'TableKit' - s.version = '2.1.2' + s.version = '2.2.0' s.homepage = 'https://github.com/maxsokolov/TableKit' s.summary = 'Type-safe declarative table views with Swift.'