objc2_ui_kit/generated/
UIConfigurationState.rs

1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use core::ffi::*;
4use core::ptr::NonNull;
5use objc2::__framework_prelude::*;
6use objc2_foundation::*;
7
8use crate::*;
9
10/// [Apple's documentation](https://developer.apple.com/documentation/uikit/uiconfigurationstatecustomkey?language=objc)
11// NS_TYPED_EXTENSIBLE_ENUM
12pub type UIConfigurationStateCustomKey = NSString;
13
14extern_protocol!(
15    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uiconfigurationstate?language=objc)
16    pub unsafe trait UIConfigurationState:
17        NSObjectProtocol + NSCopying + NSSecureCoding + MainThreadOnly
18    {
19        #[cfg(feature = "UITraitCollection")]
20        /// Returns a new instance with the specified trait collection.
21        #[unsafe(method(initWithTraitCollection:))]
22        #[unsafe(method_family = init)]
23        fn initWithTraitCollection(
24            this: Allocated<Self>,
25            trait_collection: &UITraitCollection,
26        ) -> Retained<Self>;
27
28        #[cfg(feature = "UITraitCollection")]
29        #[unsafe(method(traitCollection))]
30        #[unsafe(method_family = none)]
31        fn traitCollection(&self) -> Retained<UITraitCollection>;
32
33        #[cfg(feature = "UITraitCollection")]
34        /// Setter for [`traitCollection`][Self::traitCollection].
35        #[unsafe(method(setTraitCollection:))]
36        #[unsafe(method_family = none)]
37        fn setTraitCollection(&self, trait_collection: &UITraitCollection);
38
39        /// Returns the custom state for the specified key.
40        #[unsafe(method(customStateForKey:))]
41        #[unsafe(method_family = none)]
42        fn customStateForKey(
43            &self,
44            key: &UIConfigurationStateCustomKey,
45        ) -> Option<Retained<AnyObject>>;
46
47        /// Sets the custom state for the specified key.
48        ///
49        /// # Safety
50        ///
51        /// `custom_state` should be of the correct type.
52        #[unsafe(method(setCustomState:forKey:))]
53        #[unsafe(method_family = none)]
54        unsafe fn setCustomState_forKey(
55            &self,
56            custom_state: Option<&AnyObject>,
57            key: &UIConfigurationStateCustomKey,
58        );
59
60        #[unsafe(method(objectForKeyedSubscript:))]
61        #[unsafe(method_family = none)]
62        fn objectForKeyedSubscript(
63            &self,
64            key: &UIConfigurationStateCustomKey,
65        ) -> Option<Retained<AnyObject>>;
66
67        /// # Safety
68        ///
69        /// `obj` should be of the correct type.
70        #[unsafe(method(setObject:forKeyedSubscript:))]
71        #[unsafe(method_family = none)]
72        unsafe fn setObject_forKeyedSubscript(
73            &self,
74            obj: Option<&AnyObject>,
75            key: &UIConfigurationStateCustomKey,
76        );
77    }
78);