From c5b02a65802a59145c2d5cdd0a98f07349483ff2 Mon Sep 17 00:00:00 2001 From: Kiryl Kaveryn Date: Wed, 28 May 2025 20:26:47 +0400 Subject: [PATCH] [ios] detect isIPad taking into account `isiOSAppOnMac` And remove deprecated UI_USER_INTERFACE_IDIOM Signed-off-by: Kiryl Kaveryn --- iphone/Maps/Common/Common.swift | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/iphone/Maps/Common/Common.swift b/iphone/Maps/Common/Common.swift index 757d309d3..27a5c39c2 100644 --- a/iphone/Maps/Common/Common.swift +++ b/iphone/Maps/Common/Common.swift @@ -1,10 +1,15 @@ import Foundation -var isIPad: Bool { return UI_USER_INTERFACE_IDIOM() == .pad } +var isIPad: Bool { + if #available(iOS 14.0, *), ProcessInfo.processInfo.isiOSAppOnMac { + return true + } + return UIDevice.current.userInterfaceIdiom == .pad +} func L(_ key: String) -> String { return NSLocalizedString(key, comment: "") } -func alternative(iPhone: T, iPad: T) -> T { return isIPad ? iPad : iPhone } +func alternative(iPhone: T, iPad: T) -> T { isIPad ? iPad : iPhone } func iPadSpecific(_ f: () -> Void) { if isIPad {