rust_macios/user_notifications/
un_notification.rs

1use objc::{msg_send, sel, sel_impl};
2
3use crate::{
4    foundation::NSDate,
5    object,
6    objective_c_runtime::{
7        macros::interface_impl,
8        traits::{FromId, PNSObject},
9    },
10};
11
12use super::UNNotificationRequest;
13
14object! {
15    /// The data for a local or remote notification the system delivers to your app.
16    unsafe pub struct UNNotification;
17}
18
19#[interface_impl(NSObject)]
20impl UNNotification {
21    /* Getting the Notification Details
22     */
23
24    /// The notification request containing the payload and trigger condition for the notification.
25    #[property]
26    pub fn request(&self) -> UNNotificationRequest {
27        unsafe { UNNotificationRequest::from_id(msg_send![self.m_self(), request]) }
28    }
29
30    /// The delivery date of the notification.
31    #[property]
32    pub fn date(&self) -> NSDate {
33        unsafe { NSDate::from_id(msg_send![self.m_self(), date]) }
34    }
35}