From d120021cd9bd37c38a6cf33968c17651cbfdcdc7 Mon Sep 17 00:00:00 2001 From: jcesarmobile Date: Thu, 27 Feb 2020 13:02:05 +0100 Subject: [PATCH] fix(ios): make ActionSheetOptionStyle.Cancel show cancel button (#2496) --- ios/Capacitor/Capacitor/Plugins/Modals.swift | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/ios/Capacitor/Capacitor/Plugins/Modals.swift b/ios/Capacitor/Capacitor/Plugins/Modals.swift index d61700bee..60b770f15 100644 --- a/ios/Capacitor/Capacitor/Plugins/Modals.swift +++ b/ios/Capacitor/Capacitor/Plugins/Modals.swift @@ -110,8 +110,13 @@ public class CAPModalsPlugin : CAPPlugin { for (index, option) in options.enumerated() { let style = option["style"] as? String ?? "DEFAULT" let title = option["title"] as? String ?? "" - - let action = UIAlertAction(title: title, style: style == "DESTRUCTIVE" ? .destructive : .default, handler: { (action) -> Void in + var buttonStyle: UIAlertAction.Style = .default + if style == "DESTRUCTIVE" { + buttonStyle = .destructive + } else if style == "CANCEL" { + buttonStyle = .cancel + } + let action = UIAlertAction(title: title, style: buttonStyle, handler: { (action) -> Void in call.success([ "index": index ])