jeudi 16 février 2017

'Disable' segue for post with a conditional value iOS/ Swift

here is my situation,

on my app, I get a list of post being display by a tablew view. on click, it bring to a postdetail view via this segue:

  func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
    selectedIndexPath = indexPath.row
    self.performSegue(withIdentifier: "push", sender: self)
    self.feedTableView.reloadData()
}

With firebase, some of my post has a condition 'publishes' with boolean value ( true / false )

I 'd like somehow, if the value is on false, to disable the segue. As some posts have a 'COMING SOON' title, nothing should happen on click of those posts . . .

Do you know how is that possible to do by any chance ? Will be lovely !

Thanks a lot !

Aucun commentaire:

Enregistrer un commentaire