iOS TableView swipe UIContextualAction

I want to use uitableview swipe action but in UIContextualAction moe class there is no suitable method like below objective-c sample, am i missing something?

[UIContextualAction contextualActionWithStyle:UIContextualActionStyleDestructive …

Yeah that’s odd, contextualActionWithStyle:title:handler: is missing from the class. I’ll take a look and try fixing it.

I think I’ve found the issue. This will be fixed in the next release.

Thank you Noisyfox,
you are the life saver :grinning:

1.7.0-beta2 is released and should fix your problem. I did a rough test using the following code (in kotlin) and it worked fine.

    override fun tableViewTrailingSwipeActionsConfigurationForRowAtIndexPath(tableView: UITableView, indexPath: NSIndexPath): UISwipeActionsConfiguration {
        val deleteAction = UIContextualAction.contextualActionWithStyleTitleHandler(
        ) { action, sourceView, completionHandler ->


        val configuration = UISwipeActionsConfiguration.configurationWithActions(NatjUtil.NSArrayWithObjects(arrayOf(deleteAction)) as NSArray<out UIContextualAction>?)

        return configuration

Keep in mind this release is still in beta and you could check my road map thread for the date of a stable release.

1 Like

Thank you,
it works very well :+1:

1 Like