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 CNInstantMessageAddress;
}
#[interface_impl(NSObject)]
impl CNInstantMessageAddress {
#[method]
pub fn init_with_username_service(&mut self, username: NSString, service: NSString) -> Self
where
Self: Sized + FromId,
{
unsafe {
Self::from_id(msg_send![self.m_self(), initWithUsername: username service: service])
}
}
#[property]
pub fn service(&self) -> NSString {
unsafe { NSString::from_id(msg_send![self.m_self(), service]) }
}
#[property]
pub fn username(&self) -> NSString {
unsafe { NSString::from_id(msg_send![self.m_self(), username]) }
}
#[method]
pub fn localized_string_for_key(key: NSString) -> NSString {
unsafe { NSString::from_id(msg_send![Self::m_class(), localizedStringForKey: key]) }
}
#[method]
pub fn localized_string_for_service(service: NSString) -> NSString {
unsafe {
NSString::from_id(msg_send![
Self::m_class(),
localizedStringForService: service
])
}
}
}