Would you have an idea for this code isn't working.
@IBAction func btnStart(_ sender: UIButton) {
for i in 0..<numOfRunners {
let indexPath = IndexPath(row: i, section: 0)
let currentCell = tableView.dequeueReusableCell(withIdentifier: textCellIdentifier, for: indexPath) as! TableViewCellSetUp
/
if currentCell.txtFieldName.hasText != true {
print("checked \(indexPath)")
let alert = UIAlertController(title: "Warning!", message: "Please enter the number of runners", preferredStyle: UIAlertControllerStyle.alert)
alert.addAction(UIAlertAction(title: "Continue", style: UIAlertActionStyle.default, handler: nil))
self.present(alert, animated: true, completion: nil)
}
}
}
When I click the button, btnStart, the Alert message is displayed even when the textFields have text inside it. I, however, want the Alert message to display only, and only if, there is no text in the textField of a cell. So, When btnStart is clicked it should segue to next view.