0

I am trying to pass data from my table cell to next ViewController.

My code is as following:-

func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
    let caseid = caseData[indexPath.row]["caseid"] as? String
    print(caseid!)
    func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?){
        if (segue.identifier == "Viewmore") {
            let vc = segue.destination as! ViewData
            vc.case_id = (caseData[indexPath.row]["caseid"] as? String)!
            print(vc.case_id)
        }
    }
}

But I cannot get data in if Condition.vc.case_id print Nothing.

0 Answers0