From 737e9e6731e79bdb06328d91785e90fae76b3b1e Mon Sep 17 00:00:00 2001 From: Cosmic Flamingo Date: Tue, 2 Sep 2025 15:28:25 -0500 Subject: [PATCH] Add OK button to alerts when AlertState's buttons array is empty --- Sources/UIKitNavigation/Navigation/UIAlertController.swift | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Sources/UIKitNavigation/Navigation/UIAlertController.swift b/Sources/UIKitNavigation/Navigation/UIAlertController.swift index a8e75d4ed..4a1e62c3a 100644 --- a/Sources/UIKitNavigation/Navigation/UIAlertController.swift +++ b/Sources/UIKitNavigation/Navigation/UIAlertController.swift @@ -24,6 +24,9 @@ for button in state.buttons { addAction(UIAlertAction(button, action: handler)) } + if state.buttons.isEmpty { + addAction(UIAlertAction(title: "OK", style: .cancel)) + } } /// Creates and returns a view controller for displaying an action sheet using a data @@ -57,6 +60,9 @@ for button in state.buttons { addAction(UIAlertAction(button, action: handler)) } + if state.buttons.isEmpty { + addAction(UIAlertAction(title: "OK", style: .cancel)) + } } }