mirror of
https://codeberg.org/comaps/comaps
synced 2025-12-19 04:53:36 +00:00
[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 <kirylkaveryn@gmail.com>
This commit is contained in:
committed by
Konstantin Pastbin
parent
54455784b3
commit
d2a9e6bd2d
@@ -1,16 +1,9 @@
|
||||
extension UIViewController {
|
||||
func alternativeSizeClass<T>(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()
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user