use core_graphics::base::CGFloat;
use objc::{class, msg_send, sel, sel_impl};
use crate::foundation::id;
use crate::utils::properties::ObjcProperty;
#[derive(Clone, Debug)]
pub struct Layer {
pub objc: ObjcProperty
}
impl Layer {
pub fn new() -> Self {
Layer {
objc: ObjcProperty::retain(unsafe { msg_send![class!(CALayer), new] })
}
}
pub fn wrap(layer: id) -> Self {
Layer {
objc: ObjcProperty::from_retained(layer)
}
}
pub fn set_corner_radius(&self, radius: f64) {
self.objc.with_mut(|obj| unsafe {
let _: () = msg_send![obj, setCornerRadius: radius as CGFloat];
});
}
}