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::ptr::NonNull;
use objc2::__framework_prelude::*;
use objc2_foundation::*;

use crate::*;

extern_class!(
    /// Type that defines formatting style presented in text formatting view.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/uikit/uitextformattingviewcontrollerformattingstyle?language=objc)
    #[unsafe(super(NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    pub struct UITextFormattingViewControllerFormattingStyle;
);

extern_conformance!(
    unsafe impl NSCoding for UITextFormattingViewControllerFormattingStyle {}
);

extern_conformance!(
    unsafe impl NSCopying for UITextFormattingViewControllerFormattingStyle {}
);

unsafe impl CopyingHelper for UITextFormattingViewControllerFormattingStyle {
    type Result = Self;
}

extern_conformance!(
    unsafe impl NSObjectProtocol for UITextFormattingViewControllerFormattingStyle {}
);

extern_conformance!(
    unsafe impl NSSecureCoding for UITextFormattingViewControllerFormattingStyle {}
);

impl UITextFormattingViewControllerFormattingStyle {
    extern_methods!(
        /// Formatting style key.
        #[unsafe(method(styleKey))]
        #[unsafe(method_family = none)]
        pub fn styleKey(&self) -> Retained<NSString>;

        /// Style title displayed in UI.
        #[unsafe(method(title))]
        #[unsafe(method_family = none)]
        pub fn title(&self) -> Retained<NSString>;

        /// Attributes corresponding to this formatting style.
        ///
        /// Alongside `title`, these may be used to create a preview for this formatting style.
        #[unsafe(method(attributes))]
        #[unsafe(method_family = none)]
        pub fn attributes(&self) -> Retained<NSDictionary<NSAttributedStringKey, AnyObject>>;

        /// # Safety
        ///
        /// `attributes` generic should be of the correct type.
        #[unsafe(method(initWithStyleKey:title:attributes:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithStyleKey_title_attributes(
            this: Allocated<Self>,
            style_key: &NSString,
            string: &NSString,
            attributes: &NSDictionary<NSAttributedStringKey, AnyObject>,
        ) -> Retained<Self>;
    );
}

/// Methods declared on superclass `NSObject`.
impl UITextFormattingViewControllerFormattingStyle {
    extern_methods!(
        #[unsafe(method(init))]
        #[unsafe(method_family = init)]
        pub fn init(this: Allocated<Self>) -> Retained<Self>;

        #[unsafe(method(new))]
        #[unsafe(method_family = new)]
        pub fn new() -> Retained<Self>;
    );
}

impl DefaultRetained for UITextFormattingViewControllerFormattingStyle {
    #[inline]
    fn default_retained() -> Retained<Self> {
        Self::new()
    }
}