mirror of
https://github.com/Ranchero-Software/NetNewsWire
synced 2025-08-12 06:26:36 +00:00
Rename Extensions to UIKit Extensions
This commit is contained in:
37
iOS/UIKit Extensions/UIStoryboard-Extensions.swift
Normal file
37
iOS/UIKit Extensions/UIStoryboard-Extensions.swift
Normal file
@@ -0,0 +1,37 @@
|
||||
//
|
||||
// UIStoryboard-Extensions.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)
|
||||
}
|
||||
|
||||
static var add: UIStoryboard {
|
||||
return UIStoryboard(name: "Add", bundle: nil)
|
||||
}
|
||||
|
||||
static var settings: UIStoryboard {
|
||||
return UIStoryboard(name: "Settings", bundle: nil)
|
||||
}
|
||||
|
||||
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
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user