My scenario, I am trying to get JSON
data using codable
format. I need to pass the decoder
value to another view controller after click the Tableview custom cell. I don't know how to do that, I seen some example but its not clear.
My Code below
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
//print("You tapped cell number \(indexPath.row).")
let section = isFiltering ? filteredSections[indexPath.section] : sections[indexPath.section]
let item = section.result[indexPath.row]
print("\(item)")
let vc = self.storyboard?.instantiateViewController(withIdentifier: "secondviewcontroller") as! SecondViewController
vc.dataset = item
let navigationController = UINavigationController(rootViewController: vc)
self.present(navigationController, animated: true, completion: nil)
}