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::ffi::*;
use core::ptr::NonNull;
use objc2::__framework_prelude::*;
use objc2_foundation::*;
#[cfg(feature = "objc2-ui-kit")]
use objc2_ui_kit::*;

use crate::*;

extern_protocol!(
    /// [Apple's documentation](https://developer.apple.com/documentation/tvmlkit/tvinterfacecreating?language=objc)
    #[deprecated = "Please use SwiftUI or UIKit"]
    pub unsafe trait TVInterfaceCreating: NSObjectProtocol {
        #[cfg(all(feature = "TVViewElement", feature = "objc2-ui-kit"))]
        /// Return a view for the given view element. It is preferred to reuse the existingView if it can be updated.
        /// When existingView is an instance of UICollectionViewCell, the cell must be configured instead of creating a new instance.
        /// Application must return nil if event is not handled.
        #[deprecated = "Please use SwiftUI or UIKit"]
        #[optional]
        #[unsafe(method(viewForElement:existingView:))]
        #[unsafe(method_family = none)]
        unsafe fn viewForElement_existingView(
            &self,
            element: &TVViewElement,
            existing_view: Option<&UIView>,
            mtm: MainThreadMarker,
        ) -> Option<Retained<UIView>>;

        #[cfg(all(feature = "TVViewElement", feature = "objc2-ui-kit"))]
        /// Return a view controller for the given view element. It is preferred to reuse the existingViewController if it can be updated.
        /// Application must return nil if event is not handled.
        #[deprecated = "Please use SwiftUI or UIKit"]
        #[optional]
        #[unsafe(method(viewControllerForElement:existingViewController:))]
        #[unsafe(method_family = none)]
        unsafe fn viewControllerForElement_existingViewController(
            &self,
            element: &TVViewElement,
            existing_view_controller: Option<&UIViewController>,
            mtm: MainThreadMarker,
        ) -> Option<Retained<UIViewController>>;

        /// Return a URL given the resource name. The resource name is retrieved from a resource URL specified in elements like badge, img etc.
        /// For example,
        /// <badge
        /// src="resource://developer-resource" will request for resource with name 'developer-resource'. Application must return
        /// nil if event is not handled.
        #[deprecated = "Please use SwiftUI or UIKit"]
        #[optional]
        #[unsafe(method(URLForResource:))]
        #[unsafe(method_family = none)]
        unsafe fn URLForResource(&self, resource_name: &NSString) -> Option<Retained<NSURL>>;

        #[cfg(feature = "objc2-ui-kit")]
        /// Return a UIImage given the resource name. The resource name is retrieved from a resource URL specified in elements like badge, img etc.
        /// For example,
        /// <badge
        /// src="resource://developer-resource" will request for resource with name 'developer-resource'. This only works for image
        /// elements. Return nil if no image matches the resource name or it is not handled.
        #[deprecated = "Please use SwiftUI or UIKit"]
        #[optional]
        #[unsafe(method(imageForResource:))]
        #[unsafe(method_family = none)]
        unsafe fn imageForResource(&self, resource_name: &NSString) -> Option<Retained<UIImage>>;

        #[cfg(feature = "TVViewElement")]
        #[deprecated = "Please use SwiftUI or UIKit"]
        #[optional]
        #[unsafe(method(collectionViewCellClassForElement:))]
        #[unsafe(method_family = none)]
        unsafe fn collectionViewCellClassForElement(
            &self,
            element: &TVViewElement,
        ) -> Option<&'static AnyClass>;

        #[cfg(all(feature = "TVPlayback", feature = "objc2-ui-kit"))]
        #[deprecated = "Please use SwiftUI or UIKit"]
        #[optional]
        #[unsafe(method(playerViewControllerForPlayer:))]
        #[unsafe(method_family = none)]
        unsafe fn playerViewControllerForPlayer(
            &self,
            player: &TVPlayer,
            mtm: MainThreadMarker,
        ) -> Option<Retained<UIViewController>>;
    }
);

extern_class!(
    /// Interface factory for creation of views and view controllers. Application can extend or override framework implementation by setting extendedInterfaceCreator.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/tvmlkit/tvinterfacefactory?language=objc)
    #[unsafe(super(NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    #[deprecated = "Please use SwiftUI or UIKit"]
    pub struct TVInterfaceFactory;
);

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

extern_conformance!(
    unsafe impl TVInterfaceCreating for TVInterfaceFactory {}
);

impl TVInterfaceFactory {
    extern_methods!(
        /// Returns the singelton instance of the interface factory.
        #[deprecated = "Please use SwiftUI or UIKit"]
        #[unsafe(method(sharedInterfaceFactory))]
        #[unsafe(method_family = none)]
        pub unsafe fn sharedInterfaceFactory() -> Retained<Self>;

        /// Application must provide its own implementation to handle custom registered elements. Optionally application can also override framework implementation of farmework defined elements.
        #[deprecated = "Please use SwiftUI or UIKit"]
        #[unsafe(method(extendedInterfaceCreator))]
        #[unsafe(method_family = none)]
        pub unsafe fn extendedInterfaceCreator(
            &self,
        ) -> Option<Retained<ProtocolObject<dyn TVInterfaceCreating>>>;

        /// Setter for [`extendedInterfaceCreator`][Self::extendedInterfaceCreator].
        #[deprecated = "Please use SwiftUI or UIKit"]
        #[unsafe(method(setExtendedInterfaceCreator:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setExtendedInterfaceCreator(
            &self,
            extended_interface_creator: Option<&ProtocolObject<dyn TVInterfaceCreating>>,
        );
    );
}

/// Methods declared on superclass `NSObject`.
impl TVInterfaceFactory {
    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>;
    );
}