objc2-tv-ml-kit 0.3.2

Bindings to the TVMLKit 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::*;
#[cfg(feature = "objc2-ui-kit")]
use objc2_ui_kit::*;

use crate::*;

/// [Apple's documentation](https://developer.apple.com/documentation/tvmlkit/tvtextelementstyle?language=objc)
// NS_ENUM
#[deprecated = "Please use SwiftUI or UIKit"]
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct TVTextElementStyle(pub NSInteger);
impl TVTextElementStyle {
    #[doc(alias = "TVTextElementStyleNone")]
    #[deprecated = "Please use SwiftUI or UIKit"]
    pub const None: Self = Self(0);
    #[doc(alias = "TVTextElementStyleTitle")]
    #[deprecated = "Please use SwiftUI or UIKit"]
    pub const Title: Self = Self(1);
    #[doc(alias = "TVTextElementStyleSubtitle")]
    #[deprecated = "Please use SwiftUI or UIKit"]
    pub const Subtitle: Self = Self(2);
    #[doc(alias = "TVTextElementStyleDescription")]
    #[deprecated = "Please use SwiftUI or UIKit"]
    pub const Description: Self = Self(3);
    #[doc(alias = "TVTextElementStyleDecoration")]
    #[deprecated = "Please use SwiftUI or UIKit"]
    pub const Decoration: Self = Self(4);
}

unsafe impl Encode for TVTextElementStyle {
    const ENCODING: Encoding = NSInteger::ENCODING;
}

unsafe impl RefEncode for TVTextElementStyle {
    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}

extern_class!(
    /// Represents textual content for the DOM element.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/tvmlkit/tvtextelement?language=objc)
    #[unsafe(super(TVViewElement, NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    #[cfg(feature = "TVViewElement")]
    #[deprecated = "Please use SwiftUI or UIKit"]
    pub struct TVTextElement;
);

#[cfg(feature = "TVViewElement")]
extern_conformance!(
    unsafe impl NSCopying for TVTextElement {}
);

#[cfg(feature = "TVViewElement")]
unsafe impl CopyingHelper for TVTextElement {
    type Result = Self;
}

#[cfg(feature = "TVViewElement")]
extern_conformance!(
    unsafe impl NSObjectProtocol for TVTextElement {}
);

#[cfg(feature = "TVViewElement")]
impl TVTextElement {
    extern_methods!(
        #[deprecated = "Please use SwiftUI or UIKit"]
        #[unsafe(method(attributedText))]
        #[unsafe(method_family = none)]
        pub unsafe fn attributedText(&self) -> Option<Retained<NSAttributedString>>;

        #[deprecated = "Please use SwiftUI or UIKit"]
        #[unsafe(method(textStyle))]
        #[unsafe(method_family = none)]
        pub unsafe fn textStyle(&self) -> TVTextElementStyle;

        #[cfg(feature = "objc2-ui-kit")]
        #[deprecated = "Please use SwiftUI or UIKit"]
        #[unsafe(method(attributedStringWithFont:))]
        #[unsafe(method_family = none)]
        pub unsafe fn attributedStringWithFont(
            &self,
            font: &UIFont,
        ) -> Retained<NSAttributedString>;

        #[cfg(feature = "objc2-ui-kit")]
        #[deprecated = "Please use SwiftUI or UIKit"]
        #[unsafe(method(attributedStringWithFont:foregroundColor:textAlignment:))]
        #[unsafe(method_family = none)]
        pub unsafe fn attributedStringWithFont_foregroundColor_textAlignment(
            &self,
            font: &UIFont,
            foreground_color: Option<&UIColor>,
            alignment: NSTextAlignment,
        ) -> Retained<NSAttributedString>;
    );
}

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

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