From 405d5def7c3444b041d5a4afd97a98d5453aa1bd Mon Sep 17 00:00:00 2001 From: Shadowfacts Date: Mon, 15 Apr 2024 11:33:52 -0400 Subject: [PATCH] Disable non-stack navigation on Max iPhones --- .../Main/MainSplitViewController.swift | 24 ++++++++++++------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/Tusker/Screens/Main/MainSplitViewController.swift b/Tusker/Screens/Main/MainSplitViewController.swift index 96ad542596..004620b397 100644 --- a/Tusker/Screens/Main/MainSplitViewController.swift +++ b/Tusker/Screens/Main/MainSplitViewController.swift @@ -66,14 +66,20 @@ class MainSplitViewController: UISplitViewController { } let nav: UIViewController - navigationMode = Preferences.shared.widescreenNavigationMode - switch navigationMode! { - case .stack: + let visionIdiom = UIUserInterfaceIdiom(rawValue: 6) + if [visionIdiom, .pad, .mac].contains(UIDevice.current.userInterfaceIdiom) { + navigationMode = Preferences.shared.widescreenNavigationMode + switch navigationMode! { + case .stack: + nav = EnhancedNavigationViewController() + case .splitScreen: + nav = SplitNavigationController() + case .multiColumn: + nav = MultiColumnNavigationController() + } + } else { + navigationMode = .stack nav = EnhancedNavigationViewController() - case .splitScreen: - nav = SplitNavigationController() - case .multiColumn: - nav = MultiColumnNavigationController() } setViewController(nav, for: .secondary) @@ -115,7 +121,9 @@ class MainSplitViewController: UISplitViewController { } private func updateNavigationMode(_ mode: WidescreenNavigationMode) { - guard mode != navigationMode else { + let visionIdiom = UIUserInterfaceIdiom(rawValue: 6) + guard [visionIdiom, .pad, .mac].contains(UIDevice.current.userInterfaceIdiom), + mode != navigationMode else { return } navigationMode = mode