mirror of
https://codeberg.org/comaps/comaps
synced 2026-01-04 03:43:46 +00:00
[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:
committed by
Konstantin Pastbin
parent
d2a9e6bd2d
commit
c5b02a6580
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user