The iOS application I am writing has a bubble like feel and I want to make it constant with the whole UI. The only thing that I am not able to get constant is the trailing swipe actions. macOS Big Sur has something like what I am trying to achieve (attached). I have tried customizing the buttons, but it does not seem to have the cornerRadius attribute other elements have (UIViews, Buttons, etc). I attached a code snippet of what I did.
Is there any way for me to accomplish such actions?
func tableView(_ tableView: UITableView, trailingSwipeActionsConfigurationForRowAt indexPath: IndexPath)
-> UISwipeActionsConfiguration? {
let deleteAction = UIContextualAction(style: .destructive, title: nil) { (_, _, completionHandler) in
print("removed obj: \(self.setArr[indexPath.row])")
self.setArr.remove(at: indexPath.row)
tableView.deleteRows(at: [indexPath], with: .fade)
UserDefaults.standard.setValue(self.setArr, forKey: "sets")
completionHandler(true)
}
deleteAction.image = UIImage(systemName: "trash")
deleteAction.backgroundColor = .systemRed
let configuration = UISwipeActionsConfiguration(actions: [deleteAction])
return configuration
}
What I am trying to accomplish:
