mirror of
https://codeberg.org/comaps/comaps
synced 2025-12-20 13:23:59 +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 {
|
extension UIViewController {
|
||||||
func alternativeSizeClass<T>(iPhone: @autoclosure () -> T, iPad: @autoclosure () -> T) -> T {
|
func alternativeSizeClass<T>(iPhone: @autoclosure () -> T, iPad: @autoclosure () -> T) -> T {
|
||||||
if traitCollection.verticalSizeClass == .regular && traitCollection.horizontalSizeClass == .regular {
|
isIPad ? iPad() : iPhone()
|
||||||
return iPad()
|
|
||||||
}
|
|
||||||
return iPhone()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func alternativeSizeClass(iPhone: () -> Void, iPad: () -> Void) {
|
func alternativeSizeClass(iPhone: () -> Void, iPad: () -> Void) {
|
||||||
if traitCollection.verticalSizeClass == .regular && traitCollection.horizontalSizeClass == .regular {
|
isIPad ? iPad() : iPhone()
|
||||||
iPad()
|
|
||||||
} else {
|
|
||||||
iPhone()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user