Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bmoliveira/ae042318b909f398eadadc26cb0a0b3e to your computer and use it in GitHub Desktop.
Save bmoliveira/ae042318b909f398eadadc26cb0a0b3e to your computer and use it in GitHub Desktop.
class ExampleViewController: UIViewController {
@IBOutlet weak var collectionView: UICollectionView!
// the compiler will now complain if you don't have this implemented
// you need this to conform to SegueHandlerType
enum SegueIdentifier: String {
case TheRedPillExperience
case TheBluePillExperience
}
override func viewDidLoad() {
title = "Example title".localized()
collectionView.registerCell(ExampleCell)
}
override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {
switch segueIdentifierForSegue(segue) {
case .TheRedPillExperience:
print("😈")
case .TheBluePillExperience:
print("👼")
}
}
@IBAction func onRedPillButtonTap(sender: AnyObject) {
performSegueWithIdentifier(.TheRedPillExperience, sender: self)
}
@IBAction func onBluePillButtonTap(sender: AnyObject) {
performSegueWithIdentifier(.TheBluePillExperience, sender: self)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment