rust_macios/uikit/
ns_layout_constraint.rs1use objc::{msg_send, sel, sel_impl};
2
3use crate::{
4 foundation::NSArray,
5 object,
6 objective_c_runtime::{macros::interface_impl, traits::PNSObject},
7};
8
9object! {
10 unsafe pub struct NSLayoutConstraint;
12}
13
14#[interface_impl(NSObject)]
15impl NSLayoutConstraint {
16 #[property]
21 pub fn active(&self) -> bool {
22 unsafe { msg_send![self.m_self(), isActive] }
23 }
24
25 #[property]
31 pub fn set_active(&self, active: bool) {
32 unsafe { msg_send![self.m_self(), setActive: active] }
33 }
34
35 #[method]
41 pub fn activate_constraints(constraints: NSArray<NSLayoutConstraint>) {
42 unsafe { msg_send![Self::m_class(), activateConstraints: constraints] }
43 }
44
45 #[method]
51 pub fn deactivate_constraints(constraints: NSArray<NSLayoutConstraint>) {
52 unsafe { msg_send![Self::m_class(), deactivateConstraints: constraints] }
53 }
54}