File tree Expand file tree Collapse file tree 1 file changed +19
-3
lines changed Expand file tree Collapse file tree 1 file changed +19
-3
lines changed Original file line number Diff line number Diff line change @@ -52,10 +52,26 @@ public struct LicenseListView: View {
52
52
var navigationController : UINavigationController ? {
53
53
guard let scene = UIApplication . shared. connectedScenes. first,
54
54
let sceneDelegate = scene as? UIWindowScene ,
55
- let rootVC = sceneDelegate. windows. first? . rootViewController,
56
- let navigationController = rootVC as? UINavigationController
55
+ var controller = sceneDelegate. windows. first? . rootViewController
57
56
else { return nil }
58
- return navigationController
57
+ while true {
58
+ if let navigationController = controller as? UINavigationController ,
59
+ let visibleViewController = navigationController. visibleViewController {
60
+ controller = visibleViewController
61
+ continue
62
+ }
63
+ if let tabBarController = controller as? UITabBarController ,
64
+ let selectedViewController = tabBarController. selectedViewController {
65
+ controller = selectedViewController
66
+ continue
67
+ }
68
+ if let presentedViewController = controller. presentedViewController {
69
+ controller = presentedViewController
70
+ continue
71
+ }
72
+ break
73
+ }
74
+ return controller. navigationController
59
75
}
60
76
61
77
func libraryButton( _ library: Library ) -> some View {
You can’t perform that action at this time.
0 commit comments