Prepare for segue not passing data
Prepare for segue not passing data I'm working on a Swift project using firebase and I have a UICollectionViewController that has all the categories, and I need to pass the category Id to the next view, but It passes an empty string func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) { let category = cnameArray[indexPath.row] let catId = category.caId func prepare(for segue: UIStoryboardSegue, sender: Any?){ if segue.identifier == "CatCity" { let cityView = segue.destination as? CityViewController cityView?.catId = catId! } } self.performSegue(withIdentifier: "CatCity", sender: self) } and in my CityViewController I have var catId = String() when I put a break point at the last line of the prepare func it gets hit and the console gets the value correctly while sitting a breakpoint at CityViewController gives me an empty var. and I checked the code and my segue name and...
