When an item is selected within my tableView, I want the first func, fetchChosenExerciseData, to be executed before the second, goToSegue, is triggered. How can I implement this? I have had a look at completion blocks but to no avail.
A snippet of my code is below:
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
let cell = tableView.cellForRow(at: indexPath) as! UITableViewCell
exerciseChosen = cell.textLabel!.text!
duplicatesRemovedFromSetDataList.removeAll()
fetchChosenExerciseData()
goToSegue()
Thanks in advance.