I am trying to disable a UIContextualAction that I have:
let picture = UIContextualAction(style: .normal, title: " ", handler: { (ac: UIContextualAction, view: UIView, success:(Bool) -> Void) in
// ...
})
picture.backgroundColor = .blue
I cant find anything online to enable or disable it, I still want it present, just don't want the user to tap on it. Is this possible?
I'm not sure it can be disabled out-of-the-box, but as a workaround, you could have a global variable keeping track whether the action should be enabled and then check that in the action's handler: