Skip to content
This repository was archived by the owner on Sep 19, 2024. It is now read-only.

Commit 0adc907

Browse files
committed
Also take StoryboardSegueIdentifierType in init
So TypedStoryboardSegueInfo "types itself"
1 parent 954db2b commit 0adc907

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

Library/UIKit/TypedStoryboardSegueInfo+UIStoryboardSegue.swift

+5-4
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,12 @@ extension TypedStoryboardSegueInfo {
1515

1616
- returns: A newly initialized TypedStoryboardSegueInfo object or nil.
1717
*/
18-
public init?(segue: UIStoryboardSegue) {
18+
public init?<SegueIdentifier: StoryboardSegueIdentifierType where SegueIdentifier.SegueType == Segue, SegueIdentifier.SourceType == Source, SegueIdentifier.DestinationType == Destination>(segueIdentifier: SegueIdentifier, segue: UIStoryboardSegue) {
1919
guard let identifier = segue.identifier,
20-
sourceViewController = segue.sourceViewController as? Source,
21-
destinationViewController = segue.destinationViewController as? Destination,
22-
segue = segue as? Segue
20+
sourceViewController = segue.sourceViewController as? SegueIdentifier.SourceType,
21+
destinationViewController = segue.destinationViewController as? SegueIdentifier.DestinationType,
22+
segue = segue as? SegueIdentifier.SegueType
23+
where identifier == segueIdentifier.identifier
2324
else {
2425
return nil
2526
}

0 commit comments

Comments
 (0)