Created
November 13, 2016 02:32
-
-
Save limabeans/258ba3adabbd1d9f43903f6a6ce2d36a to your computer and use it in GitHub Desktop.
UICollectionViewCell and segue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
There is a button in each UICVCell, and we want to pass data based on a specific cell when we segue. | |
*/ | |
override func prepare(for segue: UIStoryboardSegue, sender: Any?) { | |
let destController = segue.destination as! CommentController | |
if let selectedFeedCell = (sender! as AnyObject).superview!?.superview as? FeedCell { | |
let indexPath = self.collectionView!.indexPath(for: selectedFeedCell)! | |
let row = indexPath.row | |
destController.feedItemInd = row | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment