use objc::{msg_send, sel, sel_impl};
use crate::{
foundation::NSString,
object,
objective_c_runtime::{
macros::interface_impl,
traits::{FromId, PNSObject},
},
};
object! {
unsafe pub struct CNPhoneNumber;
}
#[interface_impl(NSObject)]
impl CNPhoneNumber {
#[method]
pub fn init_with_string_value(&mut self, phone_number: NSString) -> Self
where
Self: Sized + FromId,
{
unsafe { Self::from_id(msg_send![self.m_self(), initWithString: phone_number]) }
}
#[method]
pub fn phone_number_with_string_value(phone_number: NSString) -> Self
where
Self: Sized + FromId,
{
unsafe {
Self::from_id(msg_send![
Self::m_class(),
phoneNumberWithString: phone_number
])
}
}
#[property]
pub fn string_value(&self) -> NSString {
unsafe { NSString::from_id(msg_send![self.m_self(), stringValue]) }
}
}