Skip to content

Commit 850e569

Browse files
Add OK button to alerts when AlertState's buttons array is empty (#302)
1 parent 923d507 commit 850e569

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

Sources/UIKitNavigation/Navigation/UIAlertController.swift

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@
2424
for button in state.buttons {
2525
addAction(UIAlertAction(button, action: handler))
2626
}
27+
if state.buttons.isEmpty {
28+
addAction(UIAlertAction(title: "OK", style: .cancel))
29+
}
2730
}
2831

2932
/// Creates and returns a view controller for displaying an action sheet using a data
@@ -57,6 +60,9 @@
5760
for button in state.buttons {
5861
addAction(UIAlertAction(button, action: handler))
5962
}
63+
if state.buttons.isEmpty {
64+
addAction(UIAlertAction(title: "OK", style: .cancel))
65+
}
6066
}
6167
}
6268

0 commit comments

Comments
 (0)