Код: Выделить всё
extension UIViewController {
///Async trivial alert.
func verySimple(alert: String) async {
let alert = UIAlertController(title: "", message: alert, preferredStyle: .alert)
alert.addAction(UIAlertAction(title: "Understood", style: .default) { _ in
await withCheckedContinuation { inct in
alert.dismiss(animated: false) {
inct.resume()
}
}
})
await withCheckedContinuation { ct in
present(alert, animated: false) {
ct.resume()
}
}
}
}
< /code>
Однако < /p>
Invalid conversion from 'async' function of type '(UIAlertAction)
async -> Void' to synchronous function type '(UIAlertAction) -> Void'
Подробнее здесь: https://stackoverflow.com/questions/796 ... lert-contr