Storyboards.swift 4.1 KB
Newer Older
1
2
// Generated using SwiftGen, by O.Halligon — https://github.com/SwiftGen/SwiftGen

3
// swiftlint:disable sorted_imports
4
5
6
import Foundation
import UIKit

Kateryna Kostiuk's avatar
Kateryna Kostiuk committed
7
// swiftlint:disable superfluous_disable_command
8
9
// swiftlint:disable file_length

10
protocol StoryboardType {
11
12
13
  static var storyboardName: String { get }
}

14
15
extension StoryboardType {
  static var storyboard: UIStoryboard {
16
17
    return UIStoryboard(name: self.storyboardName, bundle: Bundle(for: BundleToken.self))
  }
18
19
20
21
22
}

struct SceneType<T: Any> {
  let storyboard: StoryboardType.Type
  let identifier: String
23

24
25
26
  func instantiate() -> T {
    guard let controller = storyboard.storyboard.instantiateViewController(withIdentifier: identifier) as? T else {
      fatalError("ViewController '\(identifier)' is not of the expected class \(T.self).")
27
    }
28
    return controller
29
30
31
  }
}

32
33
34
35
36
37
38
39
struct InitialSceneType<T: Any> {
  let storyboard: StoryboardType.Type

  func instantiate() -> T {
    guard let controller = storyboard.storyboard.instantiateInitialViewController() as? T else {
      fatalError("ViewController is not of the expected class \(T.self).")
    }
    return controller
40
41
42
  }
}

43
protocol SegueType: RawRepresentable { }
44
45

extension UIViewController {
46
  func perform<S: SegueType>(segue: S, sender: Any? = nil) where S.RawValue == String {
47
48
49
50
    performSegue(withIdentifier: segue.rawValue, sender: sender)
  }
}

51
// swiftlint:disable explicit_type_interface identifier_name line_length type_body_length type_name
52
enum StoryboardScene {
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
  enum ContactRequestsViewController: StoryboardType {
    static let storyboardName = "ContactRequestsViewController"

    static let initialScene = InitialSceneType<Ring.ContactRequestsViewController>(storyboard: ContactRequestsViewController.self)
  }
  enum ConversationViewController: StoryboardType {
    static let storyboardName = "ConversationViewController"

    static let initialScene = InitialSceneType<Ring.ConversationViewController>(storyboard: ConversationViewController.self)
  }
  enum CreateAccountViewController: StoryboardType {
    static let storyboardName = "CreateAccountViewController"

    static let initialScene = InitialSceneType<Ring.CreateAccountViewController>(storyboard: CreateAccountViewController.self)
  }
  enum CreateProfileViewController: StoryboardType {
    static let storyboardName = "CreateProfileViewController"

    static let initialScene = InitialSceneType<Ring.CreateProfileViewController>(storyboard: CreateProfileViewController.self)
  }
73
  enum LaunchScreen: StoryboardType {
74
    static let storyboardName = "LaunchScreen"
75
76

    static let initialScene = InitialSceneType<UIViewController>(storyboard: LaunchScreen.self)
77
  }
78
79
  enum LinkDeviceViewController: StoryboardType {
    static let storyboardName = "LinkDeviceViewController"
80

81
82
    static let initialScene = InitialSceneType<Ring.LinkDeviceViewController>(storyboard: LinkDeviceViewController.self)
  }
Kateryna Kostiuk's avatar
Kateryna Kostiuk committed
83
84
85
86
87
  enum LinkNewDeviceViewController: StoryboardType {
    static let storyboardName = "LinkNewDeviceViewController"

    static let initialScene = InitialSceneType<Ring.LinkNewDeviceViewController>(storyboard: LinkNewDeviceViewController.self)
  }
88
89
  enum MeDetailViewController: StoryboardType {
    static let storyboardName = "MeDetailViewController"
Hadrien De Sousa's avatar
Hadrien De Sousa committed
90

91
    static let initialScene = InitialSceneType<Ring.MeDetailViewController>(storyboard: MeDetailViewController.self)
92
  }
93
94
  enum MeViewController: StoryboardType {
    static let storyboardName = "MeViewController"
95

96
    static let initialScene = InitialSceneType<Ring.MeViewController>(storyboard: MeViewController.self)
97
  }
98
99
  enum SmartlistViewController: StoryboardType {
    static let storyboardName = "SmartlistViewController"
100

101
    static let initialScene = InitialSceneType<Ring.SmartlistViewController>(storyboard: SmartlistViewController.self)
102
  }
103
104
105
106
  enum WelcomeViewController: StoryboardType {
    static let storyboardName = "WelcomeViewController"

    static let initialScene = InitialSceneType<Ring.WelcomeViewController>(storyboard: WelcomeViewController.self)
107
108
  }
}
109
110
111

enum StoryboardSegue {
}
112
// swiftlint:enable explicit_type_interface identifier_name line_length type_body_length type_name
113
114

private final class BundleToken {}