Skip to content

Commit d4c4bda

Browse files
committed
Restrict performSegueWithIdentifier extension method to source view controller type
1 parent a642bd3 commit d4c4bda

File tree

1 file changed

+13
-7
lines changed

1 file changed

+13
-7
lines changed

Library/UIKit/UIViewController+StoryboardSegueIdentifierProtocol.swift

+13-7
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,22 @@
99
import Foundation
1010
import UIKit
1111

12-
public extension UIViewController {
12+
public protocol UIViewControllerType {
13+
func performSegueWithIdentifier(identifier: String, sender: AnyObject?)
14+
}
15+
16+
extension UIViewController: UIViewControllerType { }
17+
18+
public extension UIViewControllerType {
1319
/**
14-
Initiates the segue with the specified identifier (R.segue.*) from the current view controller'€™s storyboard file.
15-
20+
Initiates the segue with the specified identifier (R.segue.*) from the current view controller's storyboard file.
1621
- parameter identifier: The R.segue.* that identifies the triggered segue.
17-
- parameter segue: The object that you want to use to initiate the segue. This object is made available for informational purposes during the actual segue.
18-
22+
- parameter sender: The object that you want to use to initiate the segue. This object is made available for informational purposes during the actual segue.
1923
- SeeAlso: Library for typed block based segues: [tomlokhorst/SegueManager](https://github.com/tomlokhorst/SegueManager)
20-
*/
21-
public func performSegueWithIdentifier<Identifier: StoryboardSegueIdentifierType>(identifier: Identifier, sender: AnyObject?) {
24+
*/
25+
public func performSegueWithIdentifier<Segue, Destination>(
26+
identifier: StoryboardSegueIdentifier<Segue, Self, Destination>,
27+
sender: AnyObject?) {
2228
performSegueWithIdentifier(identifier.identifier, sender: sender)
2329
}
2430
}

0 commit comments

Comments
 (0)