objc2_ui_kit/generated/
UISearchSuggestion.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
8use crate::*;
9
10extern_protocol!(
11    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uisearchsuggestion?language=objc)
12    pub unsafe trait UISearchSuggestion: NSObjectProtocol + MainThreadOnly {
13        /// The localized suggestion that will be displayed as the search string
14        #[unsafe(method(localizedSuggestion))]
15        #[unsafe(method_family = none)]
16        unsafe fn localizedSuggestion(&self) -> Option<Retained<NSString>>;
17
18        /// The localized description used as accessibility string
19        #[optional]
20        #[unsafe(method(localizedDescription))]
21        #[unsafe(method_family = none)]
22        unsafe fn localizedDescription(&self) -> Option<Retained<NSString>>;
23
24        #[cfg(feature = "UIImage")]
25        /// Icon that represents this search suggestion item
26        #[optional]
27        #[unsafe(method(iconImage))]
28        #[unsafe(method_family = none)]
29        unsafe fn iconImage(&self) -> Option<Retained<UIImage>>;
30
31        /// If non-null, will be displayed as the search string instead of localizedSuggestion
32        #[unsafe(method(localizedAttributedSuggestion))]
33        #[unsafe(method_family = none)]
34        unsafe fn localizedAttributedSuggestion(&self) -> Option<Retained<NSAttributedString>>;
35
36        /// User information
37        #[unsafe(method(representedObject))]
38        #[unsafe(method_family = none)]
39        unsafe fn representedObject(&self) -> Option<Retained<AnyObject>>;
40
41        /// Setter for [`representedObject`][Self::representedObject].
42        #[unsafe(method(setRepresentedObject:))]
43        #[unsafe(method_family = none)]
44        unsafe fn setRepresentedObject(&self, represented_object: Option<&AnyObject>);
45    }
46);
47
48extern_class!(
49    /// A concrete container for search suggestion string and optional image and associated information for providing shortcuts in search experience on tvOS.
50    ///
51    /// See also [Apple's documentation](https://developer.apple.com/documentation/uikit/uisearchsuggestionitem?language=objc)
52    #[unsafe(super(NSObject))]
53    #[thread_kind = MainThreadOnly]
54    #[derive(Debug, PartialEq, Eq, Hash)]
55    pub struct UISearchSuggestionItem;
56);
57
58unsafe impl NSObjectProtocol for UISearchSuggestionItem {}
59
60unsafe impl UISearchSuggestion for UISearchSuggestionItem {}
61
62impl UISearchSuggestionItem {
63    extern_methods!(
64        /// Returns a new search suggestion object with a specified suggestion string.
65        #[unsafe(method(suggestionWithLocalizedSuggestion:))]
66        #[unsafe(method_family = none)]
67        pub unsafe fn suggestionWithLocalizedSuggestion(
68            suggestion: &NSString,
69            mtm: MainThreadMarker,
70        ) -> Retained<Self>;
71
72        /// Returns a new search suggestion object with a specified suggestion string and a description string.
73        #[unsafe(method(suggestionWithLocalizedSuggestion:descriptionString:))]
74        #[unsafe(method_family = none)]
75        pub unsafe fn suggestionWithLocalizedSuggestion_descriptionString(
76            suggestion: &NSString,
77            description: Option<&NSString>,
78            mtm: MainThreadMarker,
79        ) -> Retained<Self>;
80
81        #[cfg(feature = "UIImage")]
82        /// Returns a new search suggestion object with a specified suggestion string, description string, and a search icon image.
83        #[unsafe(method(suggestionWithLocalizedSuggestion:descriptionString:iconImage:))]
84        #[unsafe(method_family = none)]
85        pub unsafe fn suggestionWithLocalizedSuggestion_descriptionString_iconImage(
86            suggestion: &NSString,
87            description: Option<&NSString>,
88            icon_image: Option<&UIImage>,
89            mtm: MainThreadMarker,
90        ) -> Retained<Self>;
91
92        /// Factory methods taking NSAttributedString instead of NSString for the suggestion
93        #[unsafe(method(suggestionWithLocalizedAttributedSuggestion:))]
94        #[unsafe(method_family = none)]
95        pub unsafe fn suggestionWithLocalizedAttributedSuggestion(
96            suggestion: &NSAttributedString,
97            mtm: MainThreadMarker,
98        ) -> Retained<Self>;
99
100        #[unsafe(method(suggestionWithLocalizedAttributedSuggestion:descriptionString:))]
101        #[unsafe(method_family = none)]
102        pub unsafe fn suggestionWithLocalizedAttributedSuggestion_descriptionString(
103            suggestion: &NSAttributedString,
104            description: Option<&NSString>,
105            mtm: MainThreadMarker,
106        ) -> Retained<Self>;
107
108        #[cfg(feature = "UIImage")]
109        #[unsafe(method(suggestionWithLocalizedAttributedSuggestion:descriptionString:iconImage:))]
110        #[unsafe(method_family = none)]
111        pub unsafe fn suggestionWithLocalizedAttributedSuggestion_descriptionString_iconImage(
112            suggestion: &NSAttributedString,
113            description: Option<&NSString>,
114            icon_image: Option<&UIImage>,
115            mtm: MainThreadMarker,
116        ) -> Retained<Self>;
117
118        /// Initializes a search suggestion object with a specified search suggestion string.
119        #[unsafe(method(initWithLocalizedSuggestion:))]
120        #[unsafe(method_family = init)]
121        pub unsafe fn initWithLocalizedSuggestion(
122            this: Allocated<Self>,
123            suggestion: &NSString,
124        ) -> Retained<Self>;
125
126        /// Initializes a search suggestion object with a specified search suggestion string and a description string.
127        #[unsafe(method(initWithLocalizedSuggestion:localizedDescription:))]
128        #[unsafe(method_family = init)]
129        pub unsafe fn initWithLocalizedSuggestion_localizedDescription(
130            this: Allocated<Self>,
131            suggestion: &NSString,
132            description: Option<&NSString>,
133        ) -> Retained<Self>;
134
135        #[cfg(feature = "UIImage")]
136        /// Initializes a search suggestion object with a specified search suggestion string, a description string, and a search icon image.
137        #[unsafe(method(initWithLocalizedSuggestion:localizedDescription:iconImage:))]
138        #[unsafe(method_family = init)]
139        pub unsafe fn initWithLocalizedSuggestion_localizedDescription_iconImage(
140            this: Allocated<Self>,
141            suggestion: &NSString,
142            description: Option<&NSString>,
143            icon_image: Option<&UIImage>,
144        ) -> Retained<Self>;
145
146        /// Initializers taking NSAttributedString instead of NSString for the suggestion
147        #[unsafe(method(initWithLocalizedAttributedSuggestion:))]
148        #[unsafe(method_family = init)]
149        pub unsafe fn initWithLocalizedAttributedSuggestion(
150            this: Allocated<Self>,
151            suggestion: &NSAttributedString,
152        ) -> Retained<Self>;
153
154        #[unsafe(method(initWithLocalizedAttributedSuggestion:localizedDescription:))]
155        #[unsafe(method_family = init)]
156        pub unsafe fn initWithLocalizedAttributedSuggestion_localizedDescription(
157            this: Allocated<Self>,
158            suggestion: &NSAttributedString,
159            description: Option<&NSString>,
160        ) -> Retained<Self>;
161
162        #[cfg(feature = "UIImage")]
163        #[unsafe(method(initWithLocalizedAttributedSuggestion:localizedDescription:iconImage:))]
164        #[unsafe(method_family = init)]
165        pub unsafe fn initWithLocalizedAttributedSuggestion_localizedDescription_iconImage(
166            this: Allocated<Self>,
167            suggestion: &NSAttributedString,
168            description: Option<&NSString>,
169            icon_image: Option<&UIImage>,
170        ) -> Retained<Self>;
171
172        /// If non-null, will be displayed as the search string instead of localizedSuggestion
173        #[unsafe(method(localizedAttributedSuggestion))]
174        #[unsafe(method_family = none)]
175        pub unsafe fn localizedAttributedSuggestion(&self) -> Option<Retained<NSAttributedString>>;
176
177        /// The localized suggestion that will be displayed as the search string
178        #[unsafe(method(localizedSuggestion))]
179        #[unsafe(method_family = none)]
180        pub unsafe fn localizedSuggestion(&self) -> Option<Retained<NSString>>;
181
182        /// The localized description used as accessibility string
183        #[unsafe(method(localizedDescription))]
184        #[unsafe(method_family = none)]
185        pub unsafe fn localizedDescription(&self) -> Option<Retained<NSString>>;
186
187        #[cfg(feature = "UIImage")]
188        /// Icon that represents this search suggestion item
189        #[unsafe(method(iconImage))]
190        #[unsafe(method_family = none)]
191        pub unsafe fn iconImage(&self) -> Option<Retained<UIImage>>;
192
193        /// User information
194        #[unsafe(method(representedObject))]
195        #[unsafe(method_family = none)]
196        pub unsafe fn representedObject(&self) -> Option<Retained<AnyObject>>;
197
198        /// Setter for [`representedObject`][Self::representedObject].
199        #[unsafe(method(setRepresentedObject:))]
200        #[unsafe(method_family = none)]
201        pub unsafe fn setRepresentedObject(&self, represented_object: Option<&AnyObject>);
202    );
203}
204
205/// Methods declared on superclass `NSObject`.
206impl UISearchSuggestionItem {
207    extern_methods!(
208        #[unsafe(method(init))]
209        #[unsafe(method_family = init)]
210        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
211
212        #[unsafe(method(new))]
213        #[unsafe(method_family = new)]
214        pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
215    );
216}