objc2_tv_ml_kit/generated/
TVInterfaceFactory.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#[cfg(feature = "objc2-ui-kit")]
8use objc2_ui_kit::*;
9
10use crate::*;
11
12extern_protocol!(
13    /// [Apple's documentation](https://developer.apple.com/documentation/tvmlkit/tvinterfacecreating?language=objc)
14    #[deprecated = "Please use SwiftUI or UIKit"]
15    pub unsafe trait TVInterfaceCreating: NSObjectProtocol {
16        #[cfg(all(feature = "TVViewElement", feature = "objc2-ui-kit"))]
17        /// Return a view for the given view element. It is preferred to reuse the existingView if it can be updated.
18        /// When existingView is an instance of UICollectionViewCell, the cell must be configured instead of creating a new instance.
19        /// Application must return nil if event is not handled.
20        #[deprecated = "Please use SwiftUI or UIKit"]
21        #[optional]
22        #[unsafe(method(viewForElement:existingView:))]
23        #[unsafe(method_family = none)]
24        unsafe fn viewForElement_existingView(
25            &self,
26            element: &TVViewElement,
27            existing_view: Option<&UIView>,
28            mtm: MainThreadMarker,
29        ) -> Option<Retained<UIView>>;
30
31        #[cfg(all(feature = "TVViewElement", feature = "objc2-ui-kit"))]
32        /// Return a view controller for the given view element. It is preferred to reuse the existingViewController if it can be updated.
33        /// Application must return nil if event is not handled.
34        #[deprecated = "Please use SwiftUI or UIKit"]
35        #[optional]
36        #[unsafe(method(viewControllerForElement:existingViewController:))]
37        #[unsafe(method_family = none)]
38        unsafe fn viewControllerForElement_existingViewController(
39            &self,
40            element: &TVViewElement,
41            existing_view_controller: Option<&UIViewController>,
42            mtm: MainThreadMarker,
43        ) -> Option<Retained<UIViewController>>;
44
45        /// Return a URL given the resource name. The resource name is retrieved from a resource URL specified in elements like badge, img etc.
46        /// For example,
47        /// <badge
48        /// src="resource://developer-resource" will request for resource with name 'developer-resource'. Application must return
49        /// nil if event is not handled.
50        #[deprecated = "Please use SwiftUI or UIKit"]
51        #[optional]
52        #[unsafe(method(URLForResource:))]
53        #[unsafe(method_family = none)]
54        unsafe fn URLForResource(&self, resource_name: &NSString) -> Option<Retained<NSURL>>;
55
56        #[cfg(feature = "objc2-ui-kit")]
57        /// Return a UIImage given the resource name. The resource name is retrieved from a resource URL specified in elements like badge, img etc.
58        /// For example,
59        /// <badge
60        /// src="resource://developer-resource" will request for resource with name 'developer-resource'. This only works for image
61        /// elements. Return nil if no image matches the resource name or it is not handled.
62        #[deprecated = "Please use SwiftUI or UIKit"]
63        #[optional]
64        #[unsafe(method(imageForResource:))]
65        #[unsafe(method_family = none)]
66        unsafe fn imageForResource(&self, resource_name: &NSString) -> Option<Retained<UIImage>>;
67
68        #[cfg(feature = "TVViewElement")]
69        #[deprecated = "Please use SwiftUI or UIKit"]
70        #[optional]
71        #[unsafe(method(collectionViewCellClassForElement:))]
72        #[unsafe(method_family = none)]
73        unsafe fn collectionViewCellClassForElement(
74            &self,
75            element: &TVViewElement,
76        ) -> Option<&'static AnyClass>;
77
78        #[cfg(all(feature = "TVPlayback", feature = "objc2-ui-kit"))]
79        #[deprecated = "Please use SwiftUI or UIKit"]
80        #[optional]
81        #[unsafe(method(playerViewControllerForPlayer:))]
82        #[unsafe(method_family = none)]
83        unsafe fn playerViewControllerForPlayer(
84            &self,
85            player: &TVPlayer,
86            mtm: MainThreadMarker,
87        ) -> Option<Retained<UIViewController>>;
88    }
89);
90
91extern_class!(
92    /// Interface factory for creation of views and view controllers. Application can extend or override framework implementation by setting extendedInterfaceCreator.
93    ///
94    /// See also [Apple's documentation](https://developer.apple.com/documentation/tvmlkit/tvinterfacefactory?language=objc)
95    #[unsafe(super(NSObject))]
96    #[derive(Debug, PartialEq, Eq, Hash)]
97    #[deprecated = "Please use SwiftUI or UIKit"]
98    pub struct TVInterfaceFactory;
99);
100
101extern_conformance!(
102    unsafe impl NSObjectProtocol for TVInterfaceFactory {}
103);
104
105extern_conformance!(
106    unsafe impl TVInterfaceCreating for TVInterfaceFactory {}
107);
108
109impl TVInterfaceFactory {
110    extern_methods!(
111        /// Returns the singelton instance of the interface factory.
112        #[deprecated = "Please use SwiftUI or UIKit"]
113        #[unsafe(method(sharedInterfaceFactory))]
114        #[unsafe(method_family = none)]
115        pub unsafe fn sharedInterfaceFactory() -> Retained<Self>;
116
117        /// Application must provide its own implementation to handle custom registered elements. Optionally application can also override framework implementation of farmework defined elements.
118        #[deprecated = "Please use SwiftUI or UIKit"]
119        #[unsafe(method(extendedInterfaceCreator))]
120        #[unsafe(method_family = none)]
121        pub unsafe fn extendedInterfaceCreator(
122            &self,
123        ) -> Option<Retained<ProtocolObject<dyn TVInterfaceCreating>>>;
124
125        /// Setter for [`extendedInterfaceCreator`][Self::extendedInterfaceCreator].
126        #[deprecated = "Please use SwiftUI or UIKit"]
127        #[unsafe(method(setExtendedInterfaceCreator:))]
128        #[unsafe(method_family = none)]
129        pub unsafe fn setExtendedInterfaceCreator(
130            &self,
131            extended_interface_creator: Option<&ProtocolObject<dyn TVInterfaceCreating>>,
132        );
133    );
134}
135
136/// Methods declared on superclass `NSObject`.
137impl TVInterfaceFactory {
138    extern_methods!(
139        #[unsafe(method(init))]
140        #[unsafe(method_family = init)]
141        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
142
143        #[unsafe(method(new))]
144        #[unsafe(method_family = new)]
145        pub unsafe fn new() -> Retained<Self>;
146    );
147}