如何从模型中发送选定的细胞数据引发Segue?

时间:2019-01-07 16:22:32

标签: arrays

func collectionView(_ collectionView:UICollectionView,didSelectItemAt indexPath:IndexPath){

    performSegue(withIdentifier: "detailVC", sender: self)
    index = indexPath.row
    passingObject = BookData.bookModels[index!]
}



override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
    if segue.identifier ==  "detailVC" {
        guard let destVC = segue.destination as? DetailVC else {return}
        destVC.reciveData = passingObject
    }
}

0 个答案:

没有答案