rust_macios/contacts/
cn_contact_property.rs1use objc::{msg_send, sel, sel_impl};
2
3use crate::{object,
4 foundation::NSString,
5 objective_c_runtime::{
6 macros::{interface_impl},
7 traits::{FromId, PNSObject},
8 },
9};
10
11use super::CNContact;
12
13object! {
14 unsafe pub struct CNContactProperty;
16}
17
18#[interface_impl(NSObject)]
19impl CNContactProperty {
20 #[property]
27 pub fn contact(&self) -> CNContact {
28 unsafe { CNContact::from_id(msg_send![self.m_self(), contact]) }
29 }
30
31 #[property]
36 pub fn key(&self) -> NSString {
37 unsafe { NSString::from_id(msg_send![self.m_self(), key]) }
38 }
39
40 #[property]
42 pub fn value(&self) -> NSString {
43 unsafe { NSString::from_id(msg_send![self.m_self(), value]) }
44 }
45
46 #[property]
48 pub fn label(&self) -> NSString {
49 unsafe { NSString::from_id(msg_send![self.m_self(), label]) }
50 }
51
52 #[property]
54 pub fn identifier(&self) -> NSString {
55 unsafe { NSString::from_id(msg_send![self.m_self(), identifier]) }
56 }
57}