From 4a5fe3debcbe18976c1f046158b5b2ec91869c95 Mon Sep 17 00:00:00 2001 From: Povilas Staskus <4062343+staskus@users.noreply.github.com> Date: Thu, 7 Aug 2025 11:24:03 +0200 Subject: [PATCH] Ensure app window and tab views are loaded before applying iPadOS18 tab fix --- WooCommerce/Classes/ViewRelated/MainTabBarController.swift | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/WooCommerce/Classes/ViewRelated/MainTabBarController.swift b/WooCommerce/Classes/ViewRelated/MainTabBarController.swift index 2a51544c3e4..83944bbe27f 100644 --- a/WooCommerce/Classes/ViewRelated/MainTabBarController.swift +++ b/WooCommerce/Classes/ViewRelated/MainTabBarController.swift @@ -190,14 +190,14 @@ final class MainTabBarController: UITabBarController { delegate = self - fixTabBarTraitCollectionOnIpadForiOS18() - // POS tab is hidden by default. updateTabViewControllers(isPOSTabVisible: false) observeSiteIDForViewControllers() observeProductImageUploadStatusUpdates() startListeningToHubMenuTabBadgeUpdates() + + fixTabBarTraitCollectionOnIpadForiOS18() } override func viewWillAppear(_ animated: Bool) { @@ -294,7 +294,7 @@ final class MainTabBarController: UITabBarController { private func fixTabBarTraitCollectionOnIpadForiOS18() { if #available(iOS 18.0, *), UIDevice.current.userInterfaceIdiom == .pad { traitOverrides.horizontalSizeClass = .compact - if let rootHorizontalSizeClass = view.window?.traitCollection.horizontalSizeClass { + if let rootHorizontalSizeClass = AppDelegate.shared.window?.traitCollection.horizontalSizeClass { tabBar.traitOverrides.horizontalSizeClass = rootHorizontalSizeClass if let viewControllers { for vc in viewControllers {