Я не могу понять, как расширить контроллер представления с помощью асинхронного контроллераIOS

Программируем под IOS
Anonymous
Я не могу понять, как расширить контроллер представления с помощью асинхронного контроллера

Сообщение Anonymous »

Короче, < /p>

Код: Выделить всё

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'
Я просто не могу понять, как сделать это встроенным в качестве одного расширения на uiviewcontroller ! Есть способ?

Подробнее здесь: https://stackoverflow.com/questions/796 ... lert-contr

Вернуться в «IOS»