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
58extern_conformance!(
59    unsafe impl NSObjectProtocol for UISearchSuggestionItem {}
60);
61
62extern_conformance!(
63    unsafe impl UISearchSuggestion for UISearchSuggestionItem {}
64);
65
66impl UISearchSuggestionItem {
67    extern_methods!(
68        /// Returns a new search suggestion object with a specified suggestion string.
69        #[unsafe(method(suggestionWithLocalizedSuggestion:))]
70        #[unsafe(method_family = none)]
71        pub unsafe fn suggestionWithLocalizedSuggestion(
72            suggestion: &NSString,
73            mtm: MainThreadMarker,
74        ) -> Retained<Self>;
75
76        /// Returns a new search suggestion object with a specified suggestion string and a description string.
77        #[unsafe(method(suggestionWithLocalizedSuggestion:descriptionString:))]
78        #[unsafe(method_family = none)]
79        pub unsafe fn suggestionWithLocalizedSuggestion_descriptionString(
80            suggestion: &NSString,
81            description: Option<&NSString>,
82            mtm: MainThreadMarker,
83        ) -> Retained<Self>;
84
85        #[cfg(feature = "UIImage")]
86        /// Returns a new search suggestion object with a specified suggestion string, description string, and a search icon image.
87        #[unsafe(method(suggestionWithLocalizedSuggestion:descriptionString:iconImage:))]
88        #[unsafe(method_family = none)]
89        pub unsafe fn suggestionWithLocalizedSuggestion_descriptionString_iconImage(
90            suggestion: &NSString,
91            description: Option<&NSString>,
92            icon_image: Option<&UIImage>,
93            mtm: MainThreadMarker,
94        ) -> Retained<Self>;
95
96        /// Factory methods taking NSAttributedString instead of NSString for the suggestion
97        #[unsafe(method(suggestionWithLocalizedAttributedSuggestion:))]
98        #[unsafe(method_family = none)]
99        pub unsafe fn suggestionWithLocalizedAttributedSuggestion(
100            suggestion: &NSAttributedString,
101            mtm: MainThreadMarker,
102        ) -> Retained<Self>;
103
104        #[unsafe(method(suggestionWithLocalizedAttributedSuggestion:descriptionString:))]
105        #[unsafe(method_family = none)]
106        pub unsafe fn suggestionWithLocalizedAttributedSuggestion_descriptionString(
107            suggestion: &NSAttributedString,
108            description: Option<&NSString>,
109            mtm: MainThreadMarker,
110        ) -> Retained<Self>;
111
112        #[cfg(feature = "UIImage")]
113        #[unsafe(method(suggestionWithLocalizedAttributedSuggestion:descriptionString:iconImage:))]
114        #[unsafe(method_family = none)]
115        pub unsafe fn suggestionWithLocalizedAttributedSuggestion_descriptionString_iconImage(
116            suggestion: &NSAttributedString,
117            description: Option<&NSString>,
118            icon_image: Option<&UIImage>,
119            mtm: MainThreadMarker,
120        ) -> Retained<Self>;
121
122        /// Initializes a search suggestion object with a specified search suggestion string.
123        #[unsafe(method(initWithLocalizedSuggestion:))]
124        #[unsafe(method_family = init)]
125        pub unsafe fn initWithLocalizedSuggestion(
126            this: Allocated<Self>,
127            suggestion: &NSString,
128        ) -> Retained<Self>;
129
130        /// Initializes a search suggestion object with a specified search suggestion string and a description string.
131        #[unsafe(method(initWithLocalizedSuggestion:localizedDescription:))]
132        #[unsafe(method_family = init)]
133        pub unsafe fn initWithLocalizedSuggestion_localizedDescription(
134            this: Allocated<Self>,
135            suggestion: &NSString,
136            description: Option<&NSString>,
137        ) -> Retained<Self>;
138
139        #[cfg(feature = "UIImage")]
140        /// Initializes a search suggestion object with a specified search suggestion string, a description string, and a search icon image.
141        #[unsafe(method(initWithLocalizedSuggestion:localizedDescription:iconImage:))]
142        #[unsafe(method_family = init)]
143        pub unsafe fn initWithLocalizedSuggestion_localizedDescription_iconImage(
144            this: Allocated<Self>,
145            suggestion: &NSString,
146            description: Option<&NSString>,
147            icon_image: Option<&UIImage>,
148        ) -> Retained<Self>;
149
150        /// Initializers taking NSAttributedString instead of NSString for the suggestion
151        #[unsafe(method(initWithLocalizedAttributedSuggestion:))]
152        #[unsafe(method_family = init)]
153        pub unsafe fn initWithLocalizedAttributedSuggestion(
154            this: Allocated<Self>,
155            suggestion: &NSAttributedString,
156        ) -> Retained<Self>;
157
158        #[unsafe(method(initWithLocalizedAttributedSuggestion:localizedDescription:))]
159        #[unsafe(method_family = init)]
160        pub unsafe fn initWithLocalizedAttributedSuggestion_localizedDescription(
161            this: Allocated<Self>,
162            suggestion: &NSAttributedString,
163            description: Option<&NSString>,
164        ) -> Retained<Self>;
165
166        #[cfg(feature = "UIImage")]
167        #[unsafe(method(initWithLocalizedAttributedSuggestion:localizedDescription:iconImage:))]
168        #[unsafe(method_family = init)]
169        pub unsafe fn initWithLocalizedAttributedSuggestion_localizedDescription_iconImage(
170            this: Allocated<Self>,
171            suggestion: &NSAttributedString,
172            description: Option<&NSString>,
173            icon_image: Option<&UIImage>,
174        ) -> Retained<Self>;
175
176        /// If non-null, will be displayed as the search string instead of localizedSuggestion
177        #[unsafe(method(localizedAttributedSuggestion))]
178        #[unsafe(method_family = none)]
179        pub unsafe fn localizedAttributedSuggestion(&self) -> Option<Retained<NSAttributedString>>;
180
181        /// The localized suggestion that will be displayed as the search string
182        #[unsafe(method(localizedSuggestion))]
183        #[unsafe(method_family = none)]
184        pub unsafe fn localizedSuggestion(&self) -> Option<Retained<NSString>>;
185
186        /// The localized description used as accessibility string
187        #[unsafe(method(localizedDescription))]
188        #[unsafe(method_family = none)]
189        pub unsafe fn localizedDescription(&self) -> Option<Retained<NSString>>;
190
191        #[cfg(feature = "UIImage")]
192        /// Icon that represents this search suggestion item
193        #[unsafe(method(iconImage))]
194        #[unsafe(method_family = none)]
195        pub unsafe fn iconImage(&self) -> Option<Retained<UIImage>>;
196
197        /// User information
198        #[unsafe(method(representedObject))]
199        #[unsafe(method_family = none)]
200        pub unsafe fn representedObject(&self) -> Option<Retained<AnyObject>>;
201
202        /// Setter for [`representedObject`][Self::representedObject].
203        #[unsafe(method(setRepresentedObject:))]
204        #[unsafe(method_family = none)]
205        pub unsafe fn setRepresentedObject(&self, represented_object: Option<&AnyObject>);
206    );
207}
208
209/// Methods declared on superclass `NSObject`.
210impl UISearchSuggestionItem {
211    extern_methods!(
212        #[unsafe(method(init))]
213        #[unsafe(method_family = init)]
214        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
215
216        #[unsafe(method(new))]
217        #[unsafe(method_family = new)]
218        pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
219    );
220}