[ios] detect isIPad taking into account isiOSAppOnMac

And remove deprecated UI_USER_INTERFACE_IDIOM

Signed-off-by: Kiryl Kaveryn <kirylkaveryn@gmail.com>
This commit is contained in:
Kiryl Kaveryn
2025-05-28 20:26:47 +04:00
committed by Konstantin Pastbin
parent d2a9e6bd2d
commit c5b02a6580

View File

@@ -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<T>(iPhone: T, iPad: T) -> T { return isIPad ? iPad : iPhone }
func alternative<T>(iPhone: T, iPad: T) -> T { isIPad ? iPad : iPhone }
func iPadSpecific(_ f: () -> Void) {
if isIPad {