maxsokolov / TableKit

Type-safe declarative table views.
MIT License
706 stars 74 forks source link

Add support for iOS 13 actions #98

Closed mrtokii closed 4 years ago

mrtokii commented 4 years ago

Support for iOS 13

Added two-finger cell selection actions

shouldBeginMultipleSelection, didBeginMultipleSelection

Added action for displaying context menu

showContextMenu

Example usage:

if #available(iOS 13.0, *) {
    tableRow.on(.showContextMenu) { options -> UIContextMenuConfiguration? in
        UIContextMenuConfiguration(identifier: nil, previewProvider: nil) { _ in
            let key = TableKitUserInfoKeys.ContextMenuInvokePoint
            let point = options.userInfo?[key] as? CGPoint ?? CGPoint()

            let action = UIAction(title: "\(point.x):\(point.y)", handler: { _ in })

            return UIMenu(title: "Menu title", children: [action])
        }
    }
}

Looks like a solution for #58

maxsokolov commented 4 years ago

@mrtokii Hey, nice, thank you!

maxsokolov commented 4 years ago

Bumped pod version to 2.11.0