diff --git a/Sources/AlertPresentable/AlertController.swift b/Sources/AlertPresentable/AlertController.swift index a86cbc7..a81702b 100644 --- a/Sources/AlertPresentable/AlertController.swift +++ b/Sources/AlertPresentable/AlertController.swift @@ -94,7 +94,7 @@ public class AlertController { /// On tap, close the alert. /// public static var no: Self { - .init(label: String(localized: String.LocalizationValue("no"), bundle: .module)) + .init(label: String(localized: String.LocalizationValue("no"), bundle: .module), role: .cancel) } /// @@ -103,7 +103,7 @@ public class AlertController { /// - parameter action: The custom action which is fired when the button was tapped just before close the alert. /// public static func no(action: @escaping () -> Void) -> Self { - .init(label: String(localized: String.LocalizationValue("no"), bundle: .module), action: action) + .init(label: String(localized: String.LocalizationValue("no"), bundle: .module), role: .cancel, action: action) } /// diff --git a/Sources/AlertPresentable/View+Alert.swift b/Sources/AlertPresentable/View+Alert.swift index 3c6f922..cf21454 100644 --- a/Sources/AlertPresentable/View+Alert.swift +++ b/Sources/AlertPresentable/View+Alert.swift @@ -34,12 +34,14 @@ private struct CommonAlert: ViewModifier { content .alert(alertController.title, isPresented: $alertController.isPresented) { ForEach(alertController.actions) { action in - Button(action.label, role: action.role) { + Button(role: action.role) { if let action = action.action { action() return } alertController.isPresented = false + } label: { + Text(action.label) } } } message: {