forked from SwiftGen/SwiftGen
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Storyboards-Message-Lowercase.swift.out
70 lines (57 loc) · 2.12 KB
/
Storyboards-Message-Lowercase.swift.out
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
// Generated using SwiftGen, by O.Halligon — https://github.com/AliSoftware/SwiftGen
import Foundation
import UIKit
protocol StoryboardSceneType {
static var storyboardName : String { get }
}
extension StoryboardSceneType {
static func storyboard() -> UIStoryboard {
return UIStoryboard(name: self.storyboardName, bundle: nil)
}
static func initialViewController() -> UIViewController {
return storyboard().instantiateInitialViewController()!
}
}
extension StoryboardSceneType where Self: RawRepresentable, Self.RawValue == String {
func viewController() -> UIViewController {
return Self.storyboard().instantiateViewControllerWithIdentifier(self.rawValue)
}
static func viewController(identifier: Self) -> UIViewController {
return identifier.viewController()
}
}
protocol StoryboardSegueType : RawRepresentable { }
extension UIViewController {
func performSegue<S : StoryboardSegueType where S.RawValue == String>(segue: S, sender: AnyObject? = nil) {
performSegueWithIdentifier(segue.rawValue, sender: sender)
}
}
struct StoryboardScene {
enum Message : String, StoryboardSceneType {
static let storyboardName = "Message"
case composer = "Composer"
static func composerViewController() -> UIViewController {
return StoryboardScene.Message.composer.viewController()
}
case messagesList = "MessagesList"
static func messagesListViewController() -> UITableViewController {
return StoryboardScene.Message.messagesList.viewController() as! UITableViewController
}
case navCtrl = "NavCtrl"
static func navCtrlViewController() -> UINavigationController {
return StoryboardScene.Message.navCtrl.viewController() as! UINavigationController
}
case urlChooser = "URLChooser"
static func urlChooserViewController() -> XXPickerViewController {
return StoryboardScene.Message.urlChooser.viewController() as! XXPickerViewController
}
}
}
struct StoryboardSegue {
enum Message : String, StoryboardSegueType {
case CustomBack = "CustomBack"
case Embed = "Embed"
case NonCustom = "NonCustom"
case Show_NavCtrl = "Show-NavCtrl"
}
}