mirror of
https://github.com/rust-windowing/winit.git
synced 2026-06-27 23:23:14 -04:00
* Use objc2::foundation CG types * Add safe abstraction over UIApplication * Add safe abstraction over UIDevice * Add safe abstraction over UIScreen * Add safe abstraction over UIWindow * Add safe abstraction over UIViewController * Add safe abstraction over UIView * Appease clippy
26 lines
668 B
Rust
26 lines
668 B
Rust
use objc2::foundation::{MainThreadMarker, NSObject};
|
|
use objc2::rc::{Id, Shared};
|
|
use objc2::{extern_class, extern_methods, msg_send_id, ClassType};
|
|
|
|
use super::super::ffi::UIUserInterfaceIdiom;
|
|
|
|
extern_class!(
|
|
#[derive(Debug, PartialEq, Eq, Hash)]
|
|
pub(crate) struct UIDevice;
|
|
|
|
unsafe impl ClassType for UIDevice {
|
|
type Super = NSObject;
|
|
}
|
|
);
|
|
|
|
extern_methods!(
|
|
unsafe impl UIDevice {
|
|
pub fn current(_mtm: MainThreadMarker) -> Id<Self, Shared> {
|
|
unsafe { msg_send_id![Self::class(), currentDevice] }
|
|
}
|
|
|
|
#[sel(userInterfaceIdiom)]
|
|
pub fn userInterfaceIdiom(&self) -> UIUserInterfaceIdiom;
|
|
}
|
|
);
|