polyhorn-ios-sys 0.4.0

Low-level iOS bindings for Polyhorn.
Documentation
use objc::runtime::*;
use objc::*;

use crate::coregraphics::CGRect;
use crate::Raw;

/// Event that is generated by `UIView.layoutSubviews()` and that contains the
/// frame of a view in screen coordinates (if mounted, otherwise in local
/// coordinates).
pub struct PLYLayoutEvent {
    object: *mut Object,
}

impl PLYLayoutEvent {
    /// Returns the frame of the view that generated this layout event.
    pub fn frame(&self) -> CGRect {
        unsafe { msg_send![self.object, frame] }
    }
}

impl Raw for PLYLayoutEvent {
    unsafe fn from_raw(object: *mut Object) -> Self {
        PLYLayoutEvent { object }
    }

    unsafe fn as_raw(&self) -> *mut Object {
        self.object
    }
}

impl Drop for PLYLayoutEvent {
    fn drop(&mut self) {
        unsafe { objc_release(self.object) }
    }
}