Искам да представя UIAlertController, когато потребител докосне ред в tableView, когато condition
не е равно на 1. След като предупреждението бъде отхвърлено, искам останалият код в didSelectRowAt IndexPath
да се изпълни. Потокът обаче спира. Предполагам, че имам нужда от нещо различно от nil
в completion:
, но съм объркан.
Представям Alert Controller така:
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
if condition != 1 {
let alertController = UIAlertController(title: "Title", message: "message", preferredStyle: .alert)
let defaultAction = UIAlertAction(title: "OK", style: .default, handler: nil)
alertController.addAction(defaultAction)
present(alertController, animated: true, completion: nil)
condition = 1
}
\\remaining code to be executed
}