rust_macios/user_notifications/
un_notification_response.rs1use objc::{msg_send, sel, sel_impl};
2use rust_macios_objective_c_runtime_proc_macros::interface_impl;
3
4use crate::{
5 foundation::NSString,
6 object,
7 objective_c_runtime::traits::{FromId, PNSObject},
8 uikit::UIScene,
9 utils::to_optional,
10};
11
12use super::UNNotification;
13
14object! {
15 unsafe pub struct UNNotificationResponse;
17}
18
19#[interface_impl(NSObject)]
20impl UNNotificationResponse {
21 #[property]
23 pub fn action_identifier(&self) -> NSString {
24 unsafe { NSString::from_id(msg_send![self.m_self(), actionIdentifier]) }
25 }
26
27 #[property]
29 pub fn notification(&self) -> UNNotification {
30 unsafe { UNNotification::from_id(msg_send![self.m_self(), notification]) }
31 }
32
33 #[property]
38 pub fn target_scene(&self) -> Option<UIScene> {
39 unsafe { to_optional(msg_send![self.m_self(), targetScene]) }
40 }
41}