Я пытаюсь перенести данные с одного viewController на другой. Я подключил viewController к другому контроллеру ViewController navigationController, а затем установил идентификатор "showItemSegue"
. Я получаю ошибку в этих двух строках:
var detailController = segue.destinationViewController as ShowItemViewController
detailController.currentId = nextId!
Изображение:
Код:
override func collectionView(collectionView: UICollectionView, didSelectItemAtIndexPath indexPath: NSIndexPath) {
nextId = itemArray?.objectAtIndex(indexPath.row).objectForKey("objectId") as? NSString
self.performSegueWithIdentifier("showItemSegue", sender: self)
}
override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject!) {
if (segue.identifier == "showItemSegue") {
var detailController = segue.destinationViewController as ShowItemViewController
detailController.currentId = nextId!
}
}