Как передать информацию по IndexPath на другой контроллер?
Пытался сделать так, но CollectionView не знает indexPathForSelectedItem:
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
if segue.identifier == "chosenPerson" {
let chosenPerson = segue.destination as! chosenPersonViewController
if let indexPath = collectionView.indexPathForSelectedItem {
chosenPerson!.userID = self.usersArray[indexPath.row].userId
}
}
}