Closed hendyevan closed 6 years ago
Hi @hendyevan can you post all the code that you use when you show the alert?
Thanks -Paolo
Hi @pmusolino ,
I create custom function :
func showAlertOneButton(title: String, description: String, style: PMAlertControllerStyle, okAction: PMAlertAction) -> PMAlertController { let alertVC = PMAlertController(title: title, description: description, image: nil, style: style) alertVC.addAction(okAction) self.present(alertVC, animated: true, completion: nil) return alertVC }
and then im using it like :
var alertVC = PMAlertController() let okAction = PMAlertAction(title: "OK", style: .default, action: { () -> Void in alertVC.dismiss(animated: true, completion: { () in self.dismiss(animated: true, completion: nil) }) }) alertVC = self.showAlertOneButton(title: "Title", description: "\(error.localizedDescription)", style: .alert, okAction: okAction)
func self.dismiss inside completion block did not called.
You don't need to call alertVC.dismiss, because the alert is automatically dismissed when the user taps inside the button.
Great, it's work. Thank you very much @pmusolino :D
Hi this is an awesome library. Im using it since swift 3 for almost my whole project. Now im using swift 4 version and run into some trouble.
alertVC.dismiss(animated: false, completion: { () in self.dismiss(animated: true, completion: nil) })
In swift 3 version, the completion block run well. However, after upgrade to swift 4, the completion block did not called. Please help me :D