mirror of
https://github.com/samuelclay/NewsBlur.git
synced 2025-08-05 16:58:59 +00:00
45 lines
1.4 KiB
Swift
45 lines
1.4 KiB
Swift
//
|
|
// Storyboards.swift
|
|
// NewsBlur
|
|
//
|
|
// Created by David Sinclair on 2020-09-24.
|
|
// Copyright © 2020 NewsBlur. All rights reserved.
|
|
//
|
|
|
|
import UIKit
|
|
|
|
/// Singleton to manage the storyboards of the app.
|
|
class Storyboards {
|
|
/// Singleton shared instance.
|
|
static let shared = Storyboards()
|
|
|
|
/// Private init to prevent others constructing a new instance.
|
|
private init() {
|
|
}
|
|
|
|
/// Main storyboard identifiers.
|
|
enum Main: String {
|
|
case feedDetail = "FeedDetailViewController"
|
|
case horizontalPages = "HorizontalPageViewController"
|
|
case verticalPages = "VerticalPageViewController"
|
|
// case storyDetail = "StoryDetailViewController" // loading from XIB currently
|
|
}
|
|
|
|
/// Storyboard names.
|
|
private struct Name {
|
|
static let main = "MainInterface"
|
|
}
|
|
|
|
/// The storyboard for the main view controllers.
|
|
private lazy var mainStoryboard: UIStoryboard = {
|
|
return UIStoryboard(name: Name.main, bundle: nil)
|
|
}()
|
|
|
|
/// Returns a view controller loaded from the main storyboard, or `nil` if it couldn't be found.
|
|
///
|
|
/// - Parameter identifier: The identifier of the controller.
|
|
/// - Returns: The instantiated view controller, or `nil`.
|
|
func controller(withIdentifier identifier: Main) -> Any? {
|
|
return mainStoryboard.instantiateViewController(withIdentifier: identifier.rawValue)
|
|
}
|
|
}
|