Skip to content

Commit

Permalink
Update UIAlertController+Ext.swift
Browse files Browse the repository at this point in the history
  • Loading branch information
eonist committed Jan 28, 2025
1 parent a6a7f12 commit 29f067a
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions Sources/PromptManager/ext/UIAlertController+Ext.swift
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,8 @@ extension UIAlertController {
*/
public static func createAlert(title: String?, msg: String?, ok: UIAlertActionHandler? = nil, cancel: UIAlertActionHandler? = nil, okTitle: String? = "OK", cancelTitle: String? = "Cancel") -> UIAlertController {
// ⚠️️️ Alternatively, ensure that the code is always executed on the main thread using the @MainActor attribute.
DispatchQueue.async/*asyncIfNotMain*/ { // Perform the following block of code asynchronously on a background queue if the current queue is not the main queue
// DispatchQueue.main.async/*asyncIfNotMain*/ { // Perform the following block of code asynchronously on a background queue if the current queue is not the main queue
// ⚠️️ just make sure this is called from main
let ac = UIAlertController(
title: title, // The title of the alert controller
message: msg, // The message of the alert controller
Expand All @@ -107,7 +108,7 @@ extension UIAlertController {
) // Add a cancel action to the alert controller with the specified title, style, and handler
}
return ac // Return the alert controller
}
// }
}
/**
* Prompt alert
Expand Down

0 comments on commit 29f067a

Please sign in to comment.