rust_macios/user_notifications/
un_notification_action_icon.rs

1use 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};
9
10object! {
11    unsafe pub struct UNNotificationActionIcon;
12}
13
14#[interface_impl(NSObject)]
15impl UNNotificationActionIcon {
16    /* Essentials
17     */
18
19    /// Creates an action icon by using a system symbol image.
20    #[method]
21    pub fn icon_with_system_image_name(system_image_name: NSString) -> Self
22    where
23        Self: Sized + FromId,
24    {
25        unsafe {
26            Self::from_id(msg_send![
27                Self::m_class(),
28                iconWithSystemImageName: system_image_name
29            ])
30        }
31    }
32
33    /// Creates an action icon based on an image in your app’s bundle, preferably in an asset catalog.
34    #[method]
35    pub fn icon_with_template_image_name(template_image_name: NSString) -> Self
36    where
37        Self: Sized + FromId,
38    {
39        unsafe {
40            Self::from_id(msg_send![
41                Self::m_class(),
42                iconWithTemplateImageName: template_image_name
43            ])
44        }
45    }
46}