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