Is It possible to use shouldPerformSegueWithIdentifier
to catch the movement of segue with following method:
override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?){
}
Here is my view controller code :
func collectionView(collectionView: UICollectionView, didSelectItemAtIndexPath indexPath: NSIndexPath) {
let poke:Pokemon!
if inSearchMode {
poke=filterPokemons[indexPath.row]
} else {
poke=pokemonlist[indexPath.row]
}
shouldPerformSegueWithIdentifier("PokemonDetailVC", sender: poke);
}
override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {
if segue.identifier == "PokemonDetailVC" {
if let detailVC = segue.destinationViewController as? PokemonDetailVC{
if let poke = sender as? Pokemon {
detailVC.pokemon=poke;
}
}
}
}
Storyboard segue reference