swiftuitableviewcornerradiusuicontextualaction

Round Corners of UIContexualAction


I am trying to round corners of UIContexualAction like in photo. Is there ways i can do it without any frameworks? result i want to see I know that here was some questions like this but answers there did not help to round corners.

    func tableView(_ tableView: UITableView, trailingSwipeActionsConfigurationForRowAt indexPath: IndexPath) -> UISwipeActionsConfiguration? {
    let deleteAction = UIContextualAction(style: .destructive, title: nil) { [weak self] (_, _, completionHandler) in
        self?.handleDeleteAction(at: indexPath)
        completionHandler(true)
    }
    
    deleteAction.backgroundColor = DynamicColor.red.getColor()
    if #available(iOS 13.0, *) {
        let deleteActionImage = UIImage(systemName: Constants.Image.deleteSystemIcon)?.withTintColor(.white, renderingMode: .alwaysOriginal)
        deleteAction.image = deleteActionImage
    }
    
    let configuration = UISwipeActionsConfiguration(actions: [deleteAction])
    return configuration
}

Solution

  • I solve it by using custom view instead of UIContexualAction and UIPangestureRecognizer for swipe actions. Unfortunately, there is no ways to round corners of UIContexualAction by UIKit without using any 3rd part frameworks.