我收到此错误 - InstantiateViewController(identifier:creator:)' 仅适用于 iOS 13.0 或更高版本
为了解决这个问题,我不得不使用这样的条件:
if #available(iOS 13.0, *) {
}
Run Code Online (Sandbox Code Playgroud)
但是没有这个条件怎么解决这个问题。
我的代码:
func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {
let vc = storyboard?.instantiateViewController(identifier: "CartViewController") as? CartViewController
vc?.bookNameToSend = bookName[indexPath.row]
vc?.bookImageToSend = bookImage[indexPath.row]
self.navigationController?.pushViewController(vc!, animated: true)
}
}
Run Code Online (Sandbox Code Playgroud)