2019-04-15 22:03:05 +02:00
|
|
|
//
|
|
|
|
// UIStoryboard+.swift
|
|
|
|
// NetNewsWire
|
|
|
|
//
|
|
|
|
// Created by Maurice Parker on 4/8/19.
|
|
|
|
// Copyright © 2019 Ranchero Software. All rights reserved.
|
|
|
|
//
|
|
|
|
|
|
|
|
import UIKit
|
|
|
|
|
|
|
|
extension UIStoryboard {
|
|
|
|
|
|
|
|
static var main: UIStoryboard {
|
|
|
|
return UIStoryboard(name: "Main", bundle: nil)
|
|
|
|
}
|
|
|
|
|
2019-04-16 20:38:07 +02:00
|
|
|
static var add: UIStoryboard {
|
|
|
|
return UIStoryboard(name: "Add", bundle: nil)
|
|
|
|
}
|
|
|
|
|
2019-04-15 22:03:05 +02:00
|
|
|
func instantiateController<T>(ofType type: T.Type = T.self) -> T where T: UIViewController {
|
|
|
|
|
|
|
|
let storyboardId = String(describing: type)
|
|
|
|
guard let viewController = instantiateViewController(withIdentifier: storyboardId) as? T else {
|
|
|
|
print("Unable to load view with Scene Identifier: \(storyboardId)")
|
|
|
|
fatalError()
|
|
|
|
}
|
|
|
|
|
|
|
|
return viewController
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|