From c8aac2e5d7056279496ad40bf2cdf5e8aa5f742b Mon Sep 17 00:00:00 2001 From: Scott Pfeil Date: Fri, 13 Oct 2023 14:21:22 -0400 Subject: [PATCH] Updated to get the upcoming view controller navigationBar model --- .../UINavigationController+Extension.swift | 2 +- MVMCoreUI/Utility/MVMCoreUIUtility+Extension.swift | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/MVMCoreUI/Containers/NavigationController/UINavigationController+Extension.swift b/MVMCoreUI/Containers/NavigationController/UINavigationController+Extension.swift index 3372c1ab..2909ce4a 100644 --- a/MVMCoreUI/Containers/NavigationController/UINavigationController+Extension.swift +++ b/MVMCoreUI/Containers/NavigationController/UINavigationController+Extension.swift @@ -119,7 +119,7 @@ public extension UINavigationController { setNavigationBarHidden(model.hidden, animated: true) } - @MainActor + @objc @MainActor func getViewController() -> UIViewController? { guard let topViewController = getViewControllers().last, let viewController = MVMCoreUIUtility.getViewControllerTraversingManagers(topViewController) else { return nil } diff --git a/MVMCoreUI/Utility/MVMCoreUIUtility+Extension.swift b/MVMCoreUI/Utility/MVMCoreUIUtility+Extension.swift index e04de6bb..05cd9ae2 100644 --- a/MVMCoreUI/Utility/MVMCoreUIUtility+Extension.swift +++ b/MVMCoreUI/Utility/MVMCoreUIUtility+Extension.swift @@ -57,9 +57,10 @@ public extension MVMCoreUIUtility { return findViews(by: type, views: queue) + matching } + @MainActor static func visibleNavigationBarStlye() -> NavigationItemStyle? { - if let vc = MVMCoreUIUtility.getCurrentVisibleController(), - let navController = NavigationController.navigationController(), + if let navController = NavigationController.navigationController(), + let vc = navController.getViewController(), let navigationBar = navController.getNavigationModel(from: vc) as? NavigationItemModel { return navigationBar.style }