Clean up iOS ffi.rs (#3530)

This makes it easier to transition to a future autogenerated version of UIKit.
This commit is contained in:
Mads Marquart 2024-02-27 21:07:52 +01:00 committed by GitHub
parent e41f0eabb1
commit a4480a0652
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
9 changed files with 67 additions and 108 deletions

View file

@ -27,7 +27,7 @@ use crate::{
window::{CustomCursor, CustomCursorSource},
};
use super::app_delegate::AppDelegate;
use super::{app_delegate::AppDelegate, uikit::UIUserInterfaceIdiom};
use super::{app_state, monitor, MonitorHandle};
use super::{
app_state::AppState,
@ -227,7 +227,14 @@ impl<T: 'static> EventLoop<T> {
// EventLoopExtIOS
impl<T: 'static> EventLoop<T> {
pub fn idiom(&self) -> Idiom {
UIDevice::current(self.mtm).userInterfaceIdiom().into()
match UIDevice::current(self.mtm).userInterfaceIdiom() {
UIUserInterfaceIdiom::Unspecified => Idiom::Unspecified,
UIUserInterfaceIdiom::Phone => Idiom::Phone,
UIUserInterfaceIdiom::Pad => Idiom::Pad,
UIUserInterfaceIdiom::TV => Idiom::TV,
UIUserInterfaceIdiom::CarPlay => Idiom::CarPlay,
_ => Idiom::Unspecified,
}
}
}