Moved to NavigationController

This commit is contained in:
Khan, Arshad 2020-07-10 23:08:46 +05:30
parent eba851f2ea
commit 5410cef8bf
2 changed files with 9 additions and 10 deletions

View File

@ -49,6 +49,7 @@ import UIKit
viewController.navigationItem.accessibilityLabel = navigationItemModel.title
viewController.navigationItem.hidesBackButton = (navigationItemModel.backButton != nil)
setNavigationButtons(navigationController: navigationController, navigationItemModel: navigationItemModel, viewController: viewController)
setNavigationTitle(navigationController: navigationController, navigationItemModel: navigationItemModel, viewController: viewController)
}
/// Convenience function for setting the navigation buttons.
@ -109,4 +110,12 @@ import UIKit
}
setNavigationBarUI(navigationController: navigationController, navigationItemModel: barModel, viewController: viewController)
}
/// Sets the title of navigation item for the view controller based on model and splitview.
public static func setNavigationTitle(navigationController: UINavigationController, navigationItemModel: NavigationItemModelProtocol?, viewController: UIViewController) {
let delegate = (viewController as? MVMCoreViewControllerProtocol)?.delegateObject?() as? MVMCoreUIDelegateObject
if let titleViewModel = navigationItemModel?.titleView, let molecule = MoleculeObjectMapping.shared()?.createMolecule(titleViewModel, delegateObject: delegate, additionalData: nil) {
viewController.navigationItem.titleView = molecule
}
}
}

View File

@ -37,8 +37,6 @@ public extension MVMCoreUISplitViewController {
setNavigationIconColor(navigationItemModel.tintColor.uiColor)
setNavigationTitle(navigationController: navigationController, navigationItemModel: navigationItemModel, viewController: viewController)
if let progress = progress {
setBottomProgressBarProgress(progress)
}
@ -110,14 +108,6 @@ public extension MVMCoreUISplitViewController {
viewController.navigationItem.setRightBarButtonItems(rightItems.count > 0 ? rightItems : nil, animated: !DisableAnimations.boolValue)
}
/// Sets the title of navigation item for the view controller based on model and splitview.
func setNavigationTitle(navigationController: UINavigationController, navigationItemModel: NavigationItemModelProtocol?, viewController: UIViewController) {
let delegate = (viewController as? MVMCoreViewControllerProtocol)?.delegateObject?() as? MVMCoreUIDelegateObject
if let titleViewModel = navigationItemModel?.titleView, let molecule = MoleculeObjectMapping.shared()?.createMolecule(titleViewModel, delegateObject: delegate, additionalData: nil) {
viewController.navigationItem.titleView = molecule
}
}
// MARK: - Legacy Functions
/// Convenience setter for legacy files. Sets the navigation item for the view controller based on the json and splitview controller
@objc static func setSplitViewController(for viewController: UIViewController, navigationController: UINavigationController, navigationJSON: [String: Any], leftPanelAccessible: Bool, rightPanelAccessible: Bool, progress: NSNumber?) throws {