From d2a9e6bd2dacb2ff7ffa2cfc10baa44b016463c1 Mon Sep 17 00:00:00 2001 From: Kiryl Kaveryn Date: Wed, 28 May 2025 20:24:54 +0400 Subject: [PATCH] [ios] fix `iPad` detection in the `alternativeSizeClass` The iPad should NOT be detected using the trait collections because in the split view the hor size class may be `compact`. Signed-off-by: Kiryl Kaveryn --- .../Categories/UIViewController+alternative.swift | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/iphone/Maps/Categories/UIViewController+alternative.swift b/iphone/Maps/Categories/UIViewController+alternative.swift index 6b2fdac9f..5b0ac0a38 100644 --- a/iphone/Maps/Categories/UIViewController+alternative.swift +++ b/iphone/Maps/Categories/UIViewController+alternative.swift @@ -1,16 +1,9 @@ extension UIViewController { func alternativeSizeClass(iPhone: @autoclosure () -> T, iPad: @autoclosure () -> T) -> T { - if traitCollection.verticalSizeClass == .regular && traitCollection.horizontalSizeClass == .regular { - return iPad() - } - return iPhone() + isIPad ? iPad() : iPhone() } func alternativeSizeClass(iPhone: () -> Void, iPad: () -> Void) { - if traitCollection.verticalSizeClass == .regular && traitCollection.horizontalSizeClass == .regular { - iPad() - } else { - iPhone() - } + isIPad ? iPad() : iPhone() } }