rust_macios/contacts/
cn_contact_relation.rs1use objc::{msg_send, sel, sel_impl};
2
3use crate::{
4 foundation::NSString,
5 object,
6 objective_c_runtime::{
7 macros::interface_impl,
8 traits::{FromId, PNSObject},
9 },
10};
11
12object! {
13 unsafe pub struct CNContactRelation;
15}
16
17#[interface_impl(NSObject)]
18impl CNContactRelation {
19 #[method]
21 pub fn init_with_name(&mut self, name: NSString) -> Self
22 where
23 Self: Sized + FromId,
24 {
25 unsafe { Self::from_id(msg_send![self.m_self(), initWithName: name]) }
26 }
27
28 #[method]
30 pub fn m_contact_relation_with_name(name: NSString) -> Self
31 where
32 Self: Sized + FromId,
33 {
34 unsafe { Self::from_id(msg_send![Self::m_class(), contactRelationWithName: name]) }
35 }
36
37 #[property]
39 pub fn name(&self) -> NSString {
40 unsafe { NSString::from_id(msg_send![self.m_self(), name]) }
41 }
42}