//
//  SubNavManagerNavigationController.swift
//  MVMCoreUI
//
//  Created by Scott Pfeil on 11/1/21.
//  Copyright © 2021 Verizon Wireless. All rights reserved.
//

import Foundation

/// The navigation controller that the tabbarpagecontrol uses for the children controllers. It always has the navigation bar hidden.
@objc public class SubNavManagerNavigationController: UINavigationController {
    
    public override init(rootViewController: UIViewController) {
        super.init(rootViewController: rootViewController)
        setNavigationBarHidden(true, animated: false)
    }
    
    public override init(nibName nibNameOrNil: String?, bundle nibBundleOrNil: Bundle?) {
        super.init(nibName: nibNameOrNil, bundle: nibBundleOrNil)
        setNavigationBarHidden(true, animated: false)
    }
    
    public override init(navigationBarClass: AnyClass?, toolbarClass: AnyClass?) {
        super.init(navigationBarClass: navigationBarClass, toolbarClass: toolbarClass)
        setNavigationBarHidden(true, animated: false)
    }
    
    public required init?(coder aDecoder: NSCoder) {
        super.init(coder: aDecoder)
        setNavigationBarHidden(true, animated: false)
    }
    
    public override func setNavigationBarHidden(_ hidden: Bool, animated: Bool) {
        guard hidden else { return }
        super.setNavigationBarHidden(hidden, animated: animated)
    }
}
