Advertisement
Guest User

Untitled

a guest
Jul 31st, 2015
193
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.55 KB | None | 0 0
  1. import UIKit
  2.  
  3. protocol SegueHandlerType {
  4. typealias SegueIdentifier: RawRepresentable
  5. }
  6.  
  7. extension SegueHandlerType where
  8. Self: UIViewController,
  9. SegueIdentifier.RawValue == String
  10. {
  11. //handleSegue with guard
  12. // There is a sample project
  13. func segueIdentifierForSegue(segue: UIStoryboardSegue) -> SegueIdentifier {
  14. guard let identifier = segue.identifier,
  15. segueIdentifier = SegueIdentifier(rawValue: identifier)
  16. else { fatalError("Unknown identifier \(segue.identifier)") }
  17. return segueIdentifier
  18. }
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement