i have passed data from didselect method of collectionView like this
collectionView
func collectionView(_ collectionView: UICollectionView, didSelectItemAt index
In addition to above answer you should expect a lot of changes of method names like: prepareForSegue to prepare or String.substringFromIndex to String.substring. The obvious method name endings are ommited/moved to the label of 1'st argument.
prepareForSegue
prepare
String.substringFromIndex
String.substring