I am working on a project where initial screens are in SwiftUI and further flow is in UIKit controllers. My problem is I want to know the visibleController on the screen or UINavigationController of the navigation stack when any of the appDelegate functions (let's say open:URL, performActionFor:shortcutItem) gets triggered.
So for that I tried to use UIApplication.shared.windows.filter {$0.isKeyWindow}.first.rootViewController but it is giving me as something like this <_TtGC7SwiftUI19UIHostingControllerGVS_15>. So here I m not getting the UINavigationController or the current visibleController.
So any idea on how to get the UINavigationController or the visible UIViewController or the NavigationStack.
Thanks in advance!