objc2-ui-kit 0.3.2

Bindings to the UIKit framework
Documentation
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use core::ffi::*;
use core::ptr::NonNull;
use objc2::__framework_prelude::*;
use objc2_foundation::*;

use crate::*;

/// [Apple's documentation](https://developer.apple.com/documentation/uikit/uiconfigurationstatecustomkey?language=objc)
// NS_TYPED_EXTENSIBLE_ENUM
pub type UIConfigurationStateCustomKey = NSString;

extern_protocol!(
    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uiconfigurationstate?language=objc)
    pub unsafe trait UIConfigurationState:
        NSObjectProtocol + NSCopying + NSSecureCoding + MainThreadOnly
    {
        #[cfg(feature = "UITraitCollection")]
        /// Returns a new instance with the specified trait collection.
        #[unsafe(method(initWithTraitCollection:))]
        #[unsafe(method_family = init)]
        fn initWithTraitCollection(
            this: Allocated<Self>,
            trait_collection: &UITraitCollection,
        ) -> Retained<Self>;

        #[cfg(feature = "UITraitCollection")]
        #[unsafe(method(traitCollection))]
        #[unsafe(method_family = none)]
        fn traitCollection(&self) -> Retained<UITraitCollection>;

        #[cfg(feature = "UITraitCollection")]
        /// Setter for [`traitCollection`][Self::traitCollection].
        #[unsafe(method(setTraitCollection:))]
        #[unsafe(method_family = none)]
        fn setTraitCollection(&self, trait_collection: &UITraitCollection);

        /// Returns the custom state for the specified key.
        #[unsafe(method(customStateForKey:))]
        #[unsafe(method_family = none)]
        fn customStateForKey(
            &self,
            key: &UIConfigurationStateCustomKey,
        ) -> Option<Retained<AnyObject>>;

        /// Sets the custom state for the specified key.
        ///
        /// # Safety
        ///
        /// `custom_state` should be of the correct type.
        #[unsafe(method(setCustomState:forKey:))]
        #[unsafe(method_family = none)]
        unsafe fn setCustomState_forKey(
            &self,
            custom_state: Option<&AnyObject>,
            key: &UIConfigurationStateCustomKey,
        );

        #[unsafe(method(objectForKeyedSubscript:))]
        #[unsafe(method_family = none)]
        fn objectForKeyedSubscript(
            &self,
            key: &UIConfigurationStateCustomKey,
        ) -> Option<Retained<AnyObject>>;

        /// # Safety
        ///
        /// `obj` should be of the correct type.
        #[unsafe(method(setObject:forKeyedSubscript:))]
        #[unsafe(method_family = none)]
        unsafe fn setObject_forKeyedSubscript(
            &self,
            obj: Option<&AnyObject>,
            key: &UIConfigurationStateCustomKey,
        );
    }
);