|
8 | 8 |
|
9 | 9 | import Foundation
|
10 | 10 |
|
| 11 | +/// Segue identifier protocol |
11 | 12 | public protocol StoryboardSegueIdentifierProtocol: Identifier {
|
| 13 | + /// Type of the segue itself |
12 | 14 | typealias SegueType
|
| 15 | + |
| 16 | + /// Type of the source view controller |
13 | 17 | typealias SourceType
|
| 18 | + |
| 19 | + /// Type of the destination view controller |
14 | 20 | typealias DestinationType
|
15 | 21 | }
|
16 | 22 |
|
| 23 | +/// Segue identifier |
17 | 24 | public struct StoryboardSegueIdentifier<Segue, Source, Destination>: StoryboardSegueIdentifierProtocol {
|
| 25 | + /// Type of the segue itself |
18 | 26 | public typealias SegueType = Segue
|
| 27 | + |
| 28 | + /// Type of the source view controller |
19 | 29 | public typealias SourceType = Source
|
| 30 | + |
| 31 | + /// Type of the destination view controller |
20 | 32 | public typealias DestinationType = Destination
|
21 | 33 |
|
| 34 | + /// Identifier string of this segue |
22 | 35 | public let identifier: String
|
23 | 36 |
|
| 37 | + /** |
| 38 | + Create a new identifier based on the identifier string |
| 39 | + |
| 40 | + - returns: A new StoryboardSegueIdentifier |
| 41 | + */ |
24 | 42 | public init(identifier: String) {
|
25 | 43 | self.identifier = identifier
|
26 | 44 | }
|
27 | 45 | }
|
28 | 46 |
|
| 47 | +/// Typed segue information |
29 | 48 | public struct TypedStoryboardSegueInfo<Segue, Source, Destination>: StoryboardSegueIdentifierProtocol {
|
| 49 | + /// Type of the segue itself |
30 | 50 | public typealias SegueType = Segue
|
| 51 | + |
| 52 | + /// Type of the source view controller |
31 | 53 | public typealias SourceType = Source
|
| 54 | + |
| 55 | + /// Type of the destination view controller |
32 | 56 | public typealias DestinationType = Destination
|
33 | 57 |
|
| 58 | + /// Segue destination view controller |
34 | 59 | public let destinationViewController: Destination
|
| 60 | + |
| 61 | + /// Segue identifier |
35 | 62 | public let identifier: String
|
| 63 | + |
| 64 | + /// The original segue |
36 | 65 | public let segue: Segue
|
| 66 | + |
| 67 | + /// Segue source view controller |
37 | 68 | public let sourceViewController: Source
|
38 | 69 | }
|
0 commit comments