Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import UIKit
- protocol SegueHandlerType {
- typealias SegueIdentifier: RawRepresentable
- }
- extension SegueHandlerType where
- Self: UIViewController,
- SegueIdentifier.RawValue == String
- {
- //handleSegue with guard
- // There is a sample project
- func segueIdentifierForSegue(segue: UIStoryboardSegue) -> SegueIdentifier {
- guard let identifier = segue.identifier,
- segueIdentifier = SegueIdentifier(rawValue: identifier)
- else { fatalError("Unknown identifier \(segue.identifier)") }
- return segueIdentifier
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement