2023-07-29 00:33:03 +02:00
|
|
|
use icrate::Foundation::{MainThreadMarker, NSObject};
|
|
|
|
|
use objc2::rc::Id;
|
|
|
|
|
use objc2::{extern_class, extern_methods, msg_send_id, mutability, ClassType};
|
2022-12-28 18:36:32 +01:00
|
|
|
|
|
|
|
|
use super::super::ffi::UIUserInterfaceIdiom;
|
|
|
|
|
|
|
|
|
|
extern_class!(
|
|
|
|
|
#[derive(Debug, PartialEq, Eq, Hash)]
|
|
|
|
|
pub(crate) struct UIDevice;
|
|
|
|
|
|
|
|
|
|
unsafe impl ClassType for UIDevice {
|
|
|
|
|
type Super = NSObject;
|
2023-07-29 00:33:03 +02:00
|
|
|
type Mutability = mutability::InteriorMutable;
|
2022-12-28 18:36:32 +01:00
|
|
|
}
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
extern_methods!(
|
|
|
|
|
unsafe impl UIDevice {
|
2023-07-29 00:33:03 +02:00
|
|
|
pub fn current(_mtm: MainThreadMarker) -> Id<Self> {
|
2022-12-28 18:36:32 +01:00
|
|
|
unsafe { msg_send_id![Self::class(), currentDevice] }
|
|
|
|
|
}
|
|
|
|
|
|
2023-07-29 00:33:03 +02:00
|
|
|
#[method(userInterfaceIdiom)]
|
2022-12-28 18:36:32 +01:00
|
|
|
pub fn userInterfaceIdiom(&self) -> UIUserInterfaceIdiom;
|
|
|
|
|
}
|
|
|
|
|
);
|