TSCustomAlertController+Ext.swift 671 B

12345678910111213141516171819202122
  1. //
  2. // TSCustomAlert+Ext.swift
  3. // AIEmoji
  4. //
  5. // Created by nkl on 2025/5/8.
  6. //
  7. import Foundation
  8. extension TSCustomAlertController {
  9. /// 确认弹窗
  10. public static func showAlert(on viewController: UIViewController, title: String?, message: String?, confirmTitle: String = "OK", confirmHandler: (() -> Void)? = nil) {
  11. let alert = UIAlertController(title: title, message: message, preferredStyle: .alert)
  12. let confirmAction = UIAlertAction(title: confirmTitle, style: .default) { _ in
  13. confirmHandler?()
  14. }
  15. alert.addAction(confirmAction)
  16. viewController.present(alert, animated: true, completion: nil)
  17. }
  18. }