objc2_ui_kit/generated/
UINavigationItem.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
10/// [Apple's documentation](https://developer.apple.com/documentation/uikit/uinavigationitemlargetitledisplaymode?language=objc)
11// NS_ENUM
12#[repr(transparent)]
13#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
14pub struct UINavigationItemLargeTitleDisplayMode(pub NSInteger);
15impl UINavigationItemLargeTitleDisplayMode {
16    /// Automatically use the large out-of-line title based on the state of the previous item in the navigation bar. An item with largeTitleDisplayMode=Automatic will show or hide the large title based on the request of the previous navigation item. If the first item pushed is set to Automatic, then it will show the large title if the navigation bar has prefersLargeTitles=YES.
17    #[doc(alias = "UINavigationItemLargeTitleDisplayModeAutomatic")]
18    pub const Automatic: Self = Self(0);
19    /// Always use a larger title when this item is topmost.
20    #[doc(alias = "UINavigationItemLargeTitleDisplayModeAlways")]
21    pub const Always: Self = Self(1);
22    /// Never use a larger title when this item is topmost.
23    #[doc(alias = "UINavigationItemLargeTitleDisplayModeNever")]
24    pub const Never: Self = Self(2);
25    /// Always use a large title when this item is topmost. If there is a back button present, this will revert to `Always`. Leading
26    /// &
27    /// center items will move to the overflow menu if present.
28    #[doc(alias = "UINavigationItemLargeTitleDisplayModeInline")]
29    pub const Inline: Self = Self(3);
30}
31
32unsafe impl Encode for UINavigationItemLargeTitleDisplayMode {
33    const ENCODING: Encoding = NSInteger::ENCODING;
34}
35
36unsafe impl RefEncode for UINavigationItemLargeTitleDisplayMode {
37    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
38}
39
40/// [Apple's documentation](https://developer.apple.com/documentation/uikit/uinavigationitembackbuttondisplaymode?language=objc)
41// NS_ENUM
42#[repr(transparent)]
43#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
44pub struct UINavigationItemBackButtonDisplayMode(pub NSInteger);
45impl UINavigationItemBackButtonDisplayMode {
46    /// Default mode, uses an appropriate title, followed by a generic title (typically 'Back'), then no title.
47    #[doc(alias = "UINavigationItemBackButtonDisplayModeDefault")]
48    pub const Default: Self = Self(0);
49    /// Generic titles only. Ignores .title and .backButtonTitle (but *not* .backBarButtonItem.title).
50    #[doc(alias = "UINavigationItemBackButtonDisplayModeGeneric")]
51    pub const Generic: Self = Self(1);
52    /// Don't use a title, just the back button indicator image.
53    #[doc(alias = "UINavigationItemBackButtonDisplayModeMinimal")]
54    pub const Minimal: Self = Self(2);
55}
56
57unsafe impl Encode for UINavigationItemBackButtonDisplayMode {
58    const ENCODING: Encoding = NSInteger::ENCODING;
59}
60
61unsafe impl RefEncode for UINavigationItemBackButtonDisplayMode {
62    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
63}
64
65/// [Apple's documentation](https://developer.apple.com/documentation/uikit/uinavigationitemsearchbarplacement?language=objc)
66// NS_ENUM
67#[repr(transparent)]
68#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
69pub struct UINavigationItemSearchBarPlacement(pub NSInteger);
70impl UINavigationItemSearchBarPlacement {
71    /// The navigation bar will choose a placement for the search bar that is appropriate for the current layout
72    #[doc(alias = "UINavigationItemSearchBarPlacementAutomatic")]
73    pub const Automatic: Self = Self(0);
74    /// The navigation bar will place the search bar inline with other content, on the trailing edge.
75    #[doc(alias = "UINavigationItemSearchBarPlacementInline")]
76    pub const Inline: Self = Self(1);
77    /// The navigation bar will place the search bar vertically stacked with other content.
78    #[doc(alias = "UINavigationItemSearchBarPlacementStacked")]
79    pub const Stacked: Self = Self(2);
80}
81
82unsafe impl Encode for UINavigationItemSearchBarPlacement {
83    const ENCODING: Encoding = NSInteger::ENCODING;
84}
85
86unsafe impl RefEncode for UINavigationItemSearchBarPlacement {
87    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
88}
89
90/// [Apple's documentation](https://developer.apple.com/documentation/uikit/uinavigationitemstyle?language=objc)
91// NS_ENUM
92#[repr(transparent)]
93#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
94pub struct UINavigationItemStyle(pub NSInteger);
95impl UINavigationItemStyle {
96    /// Traditional navigation bar behavior. Center items are placed in the overflow menu.
97    #[doc(alias = "UINavigationItemStyleNavigator")]
98    pub const Navigator: Self = Self(0);
99    /// A style designed for use as a browser. Title is leading aligned, center items are displayed. Typically used with history-based navigation.
100    #[doc(alias = "UINavigationItemStyleBrowser")]
101    pub const Browser: Self = Self(1);
102    /// A style designed for use as an editor. The back button will always present as chevron-only, title is leading aligned, center items are displayed. Typically used without navigation.
103    #[doc(alias = "UINavigationItemStyleEditor")]
104    pub const Editor: Self = Self(2);
105}
106
107unsafe impl Encode for UINavigationItemStyle {
108    const ENCODING: Encoding = NSInteger::ENCODING;
109}
110
111unsafe impl RefEncode for UINavigationItemStyle {
112    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
113}
114
115extern_protocol!(
116    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uinavigationitemrenamedelegate?language=objc)
117    pub unsafe trait UINavigationItemRenameDelegate:
118        NSObjectProtocol + MainThreadOnly
119    {
120        /// This method is called when renaming has ended. The title on the navigation item has already been changed when this method is called but
121        /// clients can make further adjustments to it when necessary.
122        #[unsafe(method(navigationItem:didEndRenamingWithTitle:))]
123        #[unsafe(method_family = none)]
124        unsafe fn navigationItem_didEndRenamingWithTitle(
125            &self,
126            navigation_item: &UINavigationItem,
127            title: &NSString,
128        );
129
130        /// Controls whether the rename action is supported for the given navigation item. For example this method is called when the navigation bar's
131        /// document menu is shown to validate if the rename action should be part of that menu.
132        #[optional]
133        #[unsafe(method(navigationItemShouldBeginRenaming:))]
134        #[unsafe(method_family = none)]
135        unsafe fn navigationItemShouldBeginRenaming(
136            &self,
137            navigation_item: &UINavigationItem,
138        ) -> bool;
139
140        /// Called when we begin renaming. Implementing this method allows for customizing the initial text that will show up in the text field as well as the
141        /// selected range of that text.
142        #[optional]
143        #[unsafe(method(navigationItem:willBeginRenamingWithSuggestedTitle:selectedRange:))]
144        #[unsafe(method_family = none)]
145        unsafe fn navigationItem_willBeginRenamingWithSuggestedTitle_selectedRange(
146            &self,
147            navigation_item: &UINavigationItem,
148            title: &NSString,
149            selected_range: NonNull<NSRange>,
150        ) -> Retained<NSString>;
151
152        /// This method can be used to prevent renaming from happening. However there are cases (e.g. when a new navigation item is pushed on the navigation
153        /// bar) where this method will not be called and instead navigationItem:didEndRenamingWithTitle: is called right away. Clients are therefore expected to
154        /// handle titles in navigationItem:didEndRenamingWithTitle: for which they would return NO from navigationItem:shouldEndRenamingWithTitle:.
155        #[optional]
156        #[unsafe(method(navigationItem:shouldEndRenamingWithTitle:))]
157        #[unsafe(method_family = none)]
158        unsafe fn navigationItem_shouldEndRenamingWithTitle(
159            &self,
160            navigation_item: &UINavigationItem,
161            title: &NSString,
162        ) -> bool;
163    }
164);
165
166extern_class!(
167    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uinavigationitem?language=objc)
168    #[unsafe(super(NSObject))]
169    #[thread_kind = MainThreadOnly]
170    #[derive(Debug, PartialEq, Eq, Hash)]
171    pub struct UINavigationItem;
172);
173
174unsafe impl NSCoding for UINavigationItem {}
175
176unsafe impl NSObjectProtocol for UINavigationItem {}
177
178impl UINavigationItem {
179    extern_methods!(
180        #[unsafe(method(initWithTitle:))]
181        #[unsafe(method_family = init)]
182        pub unsafe fn initWithTitle(this: Allocated<Self>, title: &NSString) -> Retained<Self>;
183
184        #[unsafe(method(initWithCoder:))]
185        #[unsafe(method_family = init)]
186        pub unsafe fn initWithCoder(
187            this: Allocated<Self>,
188            coder: &NSCoder,
189        ) -> Option<Retained<Self>>;
190
191        /// Title when topmost on the stack. default is nil
192        #[unsafe(method(title))]
193        #[unsafe(method_family = none)]
194        pub unsafe fn title(&self) -> Option<Retained<NSString>>;
195
196        /// Setter for [`title`][Self::title].
197        #[unsafe(method(setTitle:))]
198        #[unsafe(method_family = none)]
199        pub unsafe fn setTitle(&self, title: Option<&NSString>);
200
201        #[cfg(all(feature = "UIResponder", feature = "UIView"))]
202        /// Custom view to use in lieu of a title. May be sized horizontally. Only used when item is topmost on the stack.
203        #[unsafe(method(titleView))]
204        #[unsafe(method_family = none)]
205        pub unsafe fn titleView(&self) -> Option<Retained<UIView>>;
206
207        #[cfg(all(feature = "UIResponder", feature = "UIView"))]
208        /// Setter for [`titleView`][Self::titleView].
209        #[unsafe(method(setTitleView:))]
210        #[unsafe(method_family = none)]
211        pub unsafe fn setTitleView(&self, title_view: Option<&UIView>);
212
213        /// Explanatory text to display above the navigation bar buttons.
214        #[unsafe(method(prompt))]
215        #[unsafe(method_family = none)]
216        pub unsafe fn prompt(&self) -> Option<Retained<NSString>>;
217
218        /// Setter for [`prompt`][Self::prompt].
219        #[unsafe(method(setPrompt:))]
220        #[unsafe(method_family = none)]
221        pub unsafe fn setPrompt(&self, prompt: Option<&NSString>);
222
223        #[cfg(all(feature = "UIBarButtonItem", feature = "UIBarItem"))]
224        /// Bar button item to use for the back button when this item is the navigation bar's backItem.
225        #[unsafe(method(backBarButtonItem))]
226        #[unsafe(method_family = none)]
227        pub unsafe fn backBarButtonItem(&self) -> Option<Retained<UIBarButtonItem>>;
228
229        #[cfg(all(feature = "UIBarButtonItem", feature = "UIBarItem"))]
230        /// Setter for [`backBarButtonItem`][Self::backBarButtonItem].
231        #[unsafe(method(setBackBarButtonItem:))]
232        #[unsafe(method_family = none)]
233        pub unsafe fn setBackBarButtonItem(&self, back_bar_button_item: Option<&UIBarButtonItem>);
234
235        /// Title to use when this item is the navigation bar's backItem. Default is nil. backBarButtonItem takes precedence if both are specified.
236        #[unsafe(method(backButtonTitle))]
237        #[unsafe(method_family = none)]
238        pub unsafe fn backButtonTitle(&self) -> Option<Retained<NSString>>;
239
240        /// Setter for [`backButtonTitle`][Self::backButtonTitle].
241        #[unsafe(method(setBackButtonTitle:))]
242        #[unsafe(method_family = none)]
243        pub unsafe fn setBackButtonTitle(&self, back_button_title: Option<&NSString>);
244
245        /// If YES, this navigation item will hide the back button when it's on top of the stack.
246        #[unsafe(method(hidesBackButton))]
247        #[unsafe(method_family = none)]
248        pub unsafe fn hidesBackButton(&self) -> bool;
249
250        /// Setter for [`hidesBackButton`][Self::hidesBackButton].
251        #[unsafe(method(setHidesBackButton:))]
252        #[unsafe(method_family = none)]
253        pub unsafe fn setHidesBackButton(&self, hides_back_button: bool);
254
255        #[unsafe(method(setHidesBackButton:animated:))]
256        #[unsafe(method_family = none)]
257        pub unsafe fn setHidesBackButton_animated(&self, hides_back_button: bool, animated: bool);
258
259        /// Controls how the back button sources its title.
260        #[unsafe(method(backButtonDisplayMode))]
261        #[unsafe(method_family = none)]
262        pub unsafe fn backButtonDisplayMode(&self) -> UINavigationItemBackButtonDisplayMode;
263
264        /// Setter for [`backButtonDisplayMode`][Self::backButtonDisplayMode].
265        #[unsafe(method(setBackButtonDisplayMode:))]
266        #[unsafe(method_family = none)]
267        pub unsafe fn setBackButtonDisplayMode(
268            &self,
269            back_button_display_mode: UINavigationItemBackButtonDisplayMode,
270        );
271
272        #[cfg(all(feature = "UIAction", feature = "UIMenuElement"))]
273        /// Replaces the back action for the navigation bar. if a back button is naturally present, this replaces only its action, otherwise a back button will be synthesized with the image or title from the action.
274        #[unsafe(method(backAction))]
275        #[unsafe(method_family = none)]
276        pub unsafe fn backAction(&self) -> Option<Retained<UIAction>>;
277
278        #[cfg(all(feature = "UIAction", feature = "UIMenuElement"))]
279        /// Setter for [`backAction`][Self::backAction].
280        #[unsafe(method(setBackAction:))]
281        #[unsafe(method_family = none)]
282        pub unsafe fn setBackAction(&self, back_action: Option<&UIAction>);
283
284        #[cfg(all(feature = "UIMenu", feature = "UIMenuElement", feature = "block2"))]
285        /// When non-nil, UIKit will generate suggestedActions and call this block to generate a menu that is displayed from the title.
286        #[unsafe(method(titleMenuProvider))]
287        #[unsafe(method_family = none)]
288        pub unsafe fn titleMenuProvider(
289            &self,
290        ) -> *mut block2::Block<dyn Fn(NonNull<NSArray<UIMenuElement>>) -> *mut UIMenu>;
291
292        #[cfg(all(feature = "UIMenu", feature = "UIMenuElement", feature = "block2"))]
293        /// Setter for [`titleMenuProvider`][Self::titleMenuProvider].
294        #[unsafe(method(setTitleMenuProvider:))]
295        #[unsafe(method_family = none)]
296        pub unsafe fn setTitleMenuProvider(
297            &self,
298            title_menu_provider: Option<
299                &block2::Block<dyn Fn(NonNull<NSArray<UIMenuElement>>) -> *mut UIMenu>,
300            >,
301        );
302
303        /// When non-nil, enables the UINavigationBar to respond to the rename: action by providing an inline UI.
304        /// Setting this property to nil while a rename operation is in progress will cancel the operation immediately.
305        #[unsafe(method(renameDelegate))]
306        #[unsafe(method_family = none)]
307        pub unsafe fn renameDelegate(
308            &self,
309        ) -> Option<Retained<ProtocolObject<dyn UINavigationItemRenameDelegate>>>;
310
311        /// This is a [weak property][objc2::topics::weak_property].
312        /// Setter for [`renameDelegate`][Self::renameDelegate].
313        #[unsafe(method(setRenameDelegate:))]
314        #[unsafe(method_family = none)]
315        pub unsafe fn setRenameDelegate(
316            &self,
317            rename_delegate: Option<&ProtocolObject<dyn UINavigationItemRenameDelegate>>,
318        );
319
320        #[cfg(feature = "UIDocumentProperties")]
321        /// When non-nil, UIKit will use the metadata provided to generate additional controls displayed from the title.
322        #[unsafe(method(documentProperties))]
323        #[unsafe(method_family = none)]
324        pub unsafe fn documentProperties(&self) -> Option<Retained<UIDocumentProperties>>;
325
326        #[cfg(feature = "UIDocumentProperties")]
327        /// Setter for [`documentProperties`][Self::documentProperties].
328        #[unsafe(method(setDocumentProperties:))]
329        #[unsafe(method_family = none)]
330        pub unsafe fn setDocumentProperties(
331            &self,
332            document_properties: Option<&UIDocumentProperties>,
333        );
334
335        #[cfg(all(feature = "UIBarButtonItem", feature = "UIBarItem"))]
336        #[unsafe(method(leftBarButtonItems))]
337        #[unsafe(method_family = none)]
338        pub unsafe fn leftBarButtonItems(&self) -> Option<Retained<NSArray<UIBarButtonItem>>>;
339
340        #[cfg(all(feature = "UIBarButtonItem", feature = "UIBarItem"))]
341        /// Setter for [`leftBarButtonItems`][Self::leftBarButtonItems].
342        #[unsafe(method(setLeftBarButtonItems:))]
343        #[unsafe(method_family = none)]
344        pub unsafe fn setLeftBarButtonItems(
345            &self,
346            left_bar_button_items: Option<&NSArray<UIBarButtonItem>>,
347        );
348
349        #[cfg(all(feature = "UIBarButtonItem", feature = "UIBarItem"))]
350        #[unsafe(method(rightBarButtonItems))]
351        #[unsafe(method_family = none)]
352        pub unsafe fn rightBarButtonItems(&self) -> Option<Retained<NSArray<UIBarButtonItem>>>;
353
354        #[cfg(all(feature = "UIBarButtonItem", feature = "UIBarItem"))]
355        /// Setter for [`rightBarButtonItems`][Self::rightBarButtonItems].
356        #[unsafe(method(setRightBarButtonItems:))]
357        #[unsafe(method_family = none)]
358        pub unsafe fn setRightBarButtonItems(
359            &self,
360            right_bar_button_items: Option<&NSArray<UIBarButtonItem>>,
361        );
362
363        #[cfg(all(feature = "UIBarButtonItem", feature = "UIBarItem"))]
364        #[unsafe(method(setLeftBarButtonItems:animated:))]
365        #[unsafe(method_family = none)]
366        pub unsafe fn setLeftBarButtonItems_animated(
367            &self,
368            items: Option<&NSArray<UIBarButtonItem>>,
369            animated: bool,
370        );
371
372        #[cfg(all(feature = "UIBarButtonItem", feature = "UIBarItem"))]
373        #[unsafe(method(setRightBarButtonItems:animated:))]
374        #[unsafe(method_family = none)]
375        pub unsafe fn setRightBarButtonItems_animated(
376            &self,
377            items: Option<&NSArray<UIBarButtonItem>>,
378            animated: bool,
379        );
380
381        #[unsafe(method(leftItemsSupplementBackButton))]
382        #[unsafe(method_family = none)]
383        pub unsafe fn leftItemsSupplementBackButton(&self) -> bool;
384
385        /// Setter for [`leftItemsSupplementBackButton`][Self::leftItemsSupplementBackButton].
386        #[unsafe(method(setLeftItemsSupplementBackButton:))]
387        #[unsafe(method_family = none)]
388        pub unsafe fn setLeftItemsSupplementBackButton(
389            &self,
390            left_items_supplement_back_button: bool,
391        );
392
393        #[cfg(all(feature = "UIBarButtonItem", feature = "UIBarItem"))]
394        /// Some navigation items want to display a custom left or right item when they're on top of the stack. A custom left item replaces the regular back button unless you set leftItemsSupplementBackButton to YES
395        #[unsafe(method(leftBarButtonItem))]
396        #[unsafe(method_family = none)]
397        pub unsafe fn leftBarButtonItem(&self) -> Option<Retained<UIBarButtonItem>>;
398
399        #[cfg(all(feature = "UIBarButtonItem", feature = "UIBarItem"))]
400        /// Setter for [`leftBarButtonItem`][Self::leftBarButtonItem].
401        #[unsafe(method(setLeftBarButtonItem:))]
402        #[unsafe(method_family = none)]
403        pub unsafe fn setLeftBarButtonItem(&self, left_bar_button_item: Option<&UIBarButtonItem>);
404
405        #[cfg(all(feature = "UIBarButtonItem", feature = "UIBarItem"))]
406        #[unsafe(method(rightBarButtonItem))]
407        #[unsafe(method_family = none)]
408        pub unsafe fn rightBarButtonItem(&self) -> Option<Retained<UIBarButtonItem>>;
409
410        #[cfg(all(feature = "UIBarButtonItem", feature = "UIBarItem"))]
411        /// Setter for [`rightBarButtonItem`][Self::rightBarButtonItem].
412        #[unsafe(method(setRightBarButtonItem:))]
413        #[unsafe(method_family = none)]
414        pub unsafe fn setRightBarButtonItem(&self, right_bar_button_item: Option<&UIBarButtonItem>);
415
416        #[cfg(all(feature = "UIBarButtonItem", feature = "UIBarItem"))]
417        #[unsafe(method(setLeftBarButtonItem:animated:))]
418        #[unsafe(method_family = none)]
419        pub unsafe fn setLeftBarButtonItem_animated(
420            &self,
421            item: Option<&UIBarButtonItem>,
422            animated: bool,
423        );
424
425        #[cfg(all(feature = "UIBarButtonItem", feature = "UIBarItem"))]
426        #[unsafe(method(setRightBarButtonItem:animated:))]
427        #[unsafe(method_family = none)]
428        pub unsafe fn setRightBarButtonItem_animated(
429            &self,
430            item: Option<&UIBarButtonItem>,
431            animated: bool,
432        );
433
434        /// Setting a non-nil customizationIdentifier enables customization and UIKit will automatically save
435        /// &
436        /// restore customizations based on this identifier. The identifier must be unique within the scope of the application.
437        #[unsafe(method(customizationIdentifier))]
438        #[unsafe(method_family = none)]
439        pub unsafe fn customizationIdentifier(&self) -> Option<Retained<NSString>>;
440
441        /// Setter for [`customizationIdentifier`][Self::customizationIdentifier].
442        #[unsafe(method(setCustomizationIdentifier:))]
443        #[unsafe(method_family = none)]
444        pub unsafe fn setCustomizationIdentifier(
445            &self,
446            customization_identifier: Option<&NSString>,
447        );
448
449        #[cfg(feature = "UIBarButtonItemGroup")]
450        /// UIBarButtonItemGroups to be displayed in the leading section of the navigation bar. Items set via this method will replace items set via .leftBarButtonItem or .leftBarButtonItems.
451        #[unsafe(method(leadingItemGroups))]
452        #[unsafe(method_family = none)]
453        pub unsafe fn leadingItemGroups(&self) -> Retained<NSArray<UIBarButtonItemGroup>>;
454
455        #[cfg(feature = "UIBarButtonItemGroup")]
456        /// Setter for [`leadingItemGroups`][Self::leadingItemGroups].
457        #[unsafe(method(setLeadingItemGroups:))]
458        #[unsafe(method_family = none)]
459        pub unsafe fn setLeadingItemGroups(
460            &self,
461            leading_item_groups: &NSArray<UIBarButtonItemGroup>,
462        );
463
464        #[cfg(feature = "UIBarButtonItemGroup")]
465        /// Customizable UIBarButtonItemGroups that will be placed in the center region when the navigation bar is the browser or editor modes. In navigation mode, these items will be placed in the overflow.
466        #[unsafe(method(centerItemGroups))]
467        #[unsafe(method_family = none)]
468        pub unsafe fn centerItemGroups(&self) -> Retained<NSArray<UIBarButtonItemGroup>>;
469
470        #[cfg(feature = "UIBarButtonItemGroup")]
471        /// Setter for [`centerItemGroups`][Self::centerItemGroups].
472        #[unsafe(method(setCenterItemGroups:))]
473        #[unsafe(method_family = none)]
474        pub unsafe fn setCenterItemGroups(
475            &self,
476            center_item_groups: &NSArray<UIBarButtonItemGroup>,
477        );
478
479        #[cfg(feature = "UIBarButtonItemGroup")]
480        /// UIBarButtonItemGroups to be displayed in the trailing section of the navigation bar. Items set via this method will replace items set via .rightBarButtonItem or .rightBarButtonItems.
481        #[unsafe(method(trailingItemGroups))]
482        #[unsafe(method_family = none)]
483        pub unsafe fn trailingItemGroups(&self) -> Retained<NSArray<UIBarButtonItemGroup>>;
484
485        #[cfg(feature = "UIBarButtonItemGroup")]
486        /// Setter for [`trailingItemGroups`][Self::trailingItemGroups].
487        #[unsafe(method(setTrailingItemGroups:))]
488        #[unsafe(method_family = none)]
489        pub unsafe fn setTrailingItemGroups(
490            &self,
491            trailing_item_groups: &NSArray<UIBarButtonItemGroup>,
492        );
493
494        #[cfg(feature = "UIBarButtonItemGroup")]
495        /// Set a group of items to be placed on the trailing edge of the bar, past the overflow
496        /// &
497        /// search items (if present). If you wish to have more than 1 item, it is HIGHLY recommended to assign a representative item to the group to avoid overflowing the bar as this group cannot move to the overflow.
498        #[unsafe(method(pinnedTrailingGroup))]
499        #[unsafe(method_family = none)]
500        pub unsafe fn pinnedTrailingGroup(&self) -> Option<Retained<UIBarButtonItemGroup>>;
501
502        #[cfg(feature = "UIBarButtonItemGroup")]
503        /// Setter for [`pinnedTrailingGroup`][Self::pinnedTrailingGroup].
504        #[unsafe(method(setPinnedTrailingGroup:))]
505        #[unsafe(method_family = none)]
506        pub unsafe fn setPinnedTrailingGroup(
507            &self,
508            pinned_trailing_group: Option<&UIBarButtonItemGroup>,
509        );
510
511        #[cfg(all(feature = "UIDeferredMenuElement", feature = "UIMenuElement"))]
512        /// Additional items to add to the overflow menu. Setting this property to a non-nil value will force the overflow button to appear, regardless of if you provide any content in the element's callback. Items returned are displayed directly in the presented menu.
513        #[unsafe(method(additionalOverflowItems))]
514        #[unsafe(method_family = none)]
515        pub unsafe fn additionalOverflowItems(&self) -> Option<Retained<UIDeferredMenuElement>>;
516
517        #[cfg(all(feature = "UIDeferredMenuElement", feature = "UIMenuElement"))]
518        /// Setter for [`additionalOverflowItems`][Self::additionalOverflowItems].
519        #[unsafe(method(setAdditionalOverflowItems:))]
520        #[unsafe(method_family = none)]
521        pub unsafe fn setAdditionalOverflowItems(
522            &self,
523            additional_overflow_items: Option<&UIDeferredMenuElement>,
524        );
525
526        #[cfg(feature = "UIPopoverPresentationControllerSourceItem")]
527        /// If the overflow button for this item is currently present, then this will return a non-nil item that can be used as a presentation source (e.g. for popovers). Otherwise it will return nil.
528        #[unsafe(method(overflowPresentationSource))]
529        #[unsafe(method_family = none)]
530        pub unsafe fn overflowPresentationSource(
531            &self,
532        ) -> Option<Retained<ProtocolObject<dyn UIPopoverPresentationControllerSourceItem>>>;
533
534        /// When UINavigationBar.prefersLargeTitles=YES, this property controls when the larger out-of-line title is displayed. If prefersLargeTitles=NO, this property has no effect. The default value is Automatic.
535        #[unsafe(method(largeTitleDisplayMode))]
536        #[unsafe(method_family = none)]
537        pub unsafe fn largeTitleDisplayMode(&self) -> UINavigationItemLargeTitleDisplayMode;
538
539        /// Setter for [`largeTitleDisplayMode`][Self::largeTitleDisplayMode].
540        #[unsafe(method(setLargeTitleDisplayMode:))]
541        #[unsafe(method_family = none)]
542        pub unsafe fn setLargeTitleDisplayMode(
543            &self,
544            large_title_display_mode: UINavigationItemLargeTitleDisplayMode,
545        );
546
547        /// Controls how content defined by this item is laid out in the navigation bar.
548        #[unsafe(method(style))]
549        #[unsafe(method_family = none)]
550        pub unsafe fn style(&self) -> UINavigationItemStyle;
551
552        /// Setter for [`style`][Self::style].
553        #[unsafe(method(setStyle:))]
554        #[unsafe(method_family = none)]
555        pub unsafe fn setStyle(&self, style: UINavigationItemStyle);
556
557        #[cfg(all(
558            feature = "UIResponder",
559            feature = "UISearchController",
560            feature = "UIViewController"
561        ))]
562        /// A view controller that will be shown inside of a navigation controller can assign a UISearchController to this property to display the search controller’s search bar in its containing navigation controller’s navigation bar.
563        #[unsafe(method(searchController))]
564        #[unsafe(method_family = none)]
565        pub unsafe fn searchController(&self) -> Option<Retained<UISearchController>>;
566
567        #[cfg(all(
568            feature = "UIResponder",
569            feature = "UISearchController",
570            feature = "UIViewController"
571        ))]
572        /// Setter for [`searchController`][Self::searchController].
573        #[unsafe(method(setSearchController:))]
574        #[unsafe(method_family = none)]
575        pub unsafe fn setSearchController(&self, search_controller: Option<&UISearchController>);
576
577        /// If this property is true (the default), the searchController’s search bar will hide as the user scrolls in the top view controller’s scroll view. If false, the search bar will remain visible and pinned underneath the navigation bar.
578        /// Not appicable and ignored for UINavigationItemSearchBarPlacementInline
579        #[unsafe(method(hidesSearchBarWhenScrolling))]
580        #[unsafe(method_family = none)]
581        pub unsafe fn hidesSearchBarWhenScrolling(&self) -> bool;
582
583        /// Setter for [`hidesSearchBarWhenScrolling`][Self::hidesSearchBarWhenScrolling].
584        #[unsafe(method(setHidesSearchBarWhenScrolling:))]
585        #[unsafe(method_family = none)]
586        pub unsafe fn setHidesSearchBarWhenScrolling(&self, hides_search_bar_when_scrolling: bool);
587
588        /// The preferred search bar placement, when a search controller is assigned to this item.
589        #[unsafe(method(preferredSearchBarPlacement))]
590        #[unsafe(method_family = none)]
591        pub unsafe fn preferredSearchBarPlacement(&self) -> UINavigationItemSearchBarPlacement;
592
593        /// Setter for [`preferredSearchBarPlacement`][Self::preferredSearchBarPlacement].
594        #[unsafe(method(setPreferredSearchBarPlacement:))]
595        #[unsafe(method_family = none)]
596        pub unsafe fn setPreferredSearchBarPlacement(
597            &self,
598            preferred_search_bar_placement: UINavigationItemSearchBarPlacement,
599        );
600
601        /// The realized placement. Only valid if a search controller has been assigned to this item.
602        #[unsafe(method(searchBarPlacement))]
603        #[unsafe(method_family = none)]
604        pub unsafe fn searchBarPlacement(&self) -> UINavigationItemSearchBarPlacement;
605
606        #[cfg(all(feature = "UIBarAppearance", feature = "UINavigationBarAppearance"))]
607        /// When set and this item is topmost, overrides the hosting navigation bar's standardAppearance. See UINavigationBar.standardAppearance for further details.
608        #[unsafe(method(standardAppearance))]
609        #[unsafe(method_family = none)]
610        pub unsafe fn standardAppearance(&self) -> Option<Retained<UINavigationBarAppearance>>;
611
612        #[cfg(all(feature = "UIBarAppearance", feature = "UINavigationBarAppearance"))]
613        /// Setter for [`standardAppearance`][Self::standardAppearance].
614        #[unsafe(method(setStandardAppearance:))]
615        #[unsafe(method_family = none)]
616        pub unsafe fn setStandardAppearance(
617            &self,
618            standard_appearance: Option<&UINavigationBarAppearance>,
619        );
620
621        #[cfg(all(feature = "UIBarAppearance", feature = "UINavigationBarAppearance"))]
622        /// When set and this item is topmost, overrides the hosting navigation bar's compactAppearance. See UINavigationBar.compactAppearance for further details.
623        #[unsafe(method(compactAppearance))]
624        #[unsafe(method_family = none)]
625        pub unsafe fn compactAppearance(&self) -> Option<Retained<UINavigationBarAppearance>>;
626
627        #[cfg(all(feature = "UIBarAppearance", feature = "UINavigationBarAppearance"))]
628        /// Setter for [`compactAppearance`][Self::compactAppearance].
629        #[unsafe(method(setCompactAppearance:))]
630        #[unsafe(method_family = none)]
631        pub unsafe fn setCompactAppearance(
632            &self,
633            compact_appearance: Option<&UINavigationBarAppearance>,
634        );
635
636        #[cfg(all(feature = "UIBarAppearance", feature = "UINavigationBarAppearance"))]
637        /// When set and this item is topmost, overrides the hosting navigation bar's scrollEdgeAppearance. See UINavigationBar.scrollEdgeAppearance for further details.
638        #[unsafe(method(scrollEdgeAppearance))]
639        #[unsafe(method_family = none)]
640        pub unsafe fn scrollEdgeAppearance(&self) -> Option<Retained<UINavigationBarAppearance>>;
641
642        #[cfg(all(feature = "UIBarAppearance", feature = "UINavigationBarAppearance"))]
643        /// Setter for [`scrollEdgeAppearance`][Self::scrollEdgeAppearance].
644        #[unsafe(method(setScrollEdgeAppearance:))]
645        #[unsafe(method_family = none)]
646        pub unsafe fn setScrollEdgeAppearance(
647            &self,
648            scroll_edge_appearance: Option<&UINavigationBarAppearance>,
649        );
650
651        #[cfg(all(feature = "UIBarAppearance", feature = "UINavigationBarAppearance"))]
652        /// When set and this item is topmost, overrides the hosting navigation bar's compactScrollEdgeAppearance. See UINavigationBar.h for further details.
653        #[unsafe(method(compactScrollEdgeAppearance))]
654        #[unsafe(method_family = none)]
655        pub unsafe fn compactScrollEdgeAppearance(
656            &self,
657        ) -> Option<Retained<UINavigationBarAppearance>>;
658
659        #[cfg(all(feature = "UIBarAppearance", feature = "UINavigationBarAppearance"))]
660        /// Setter for [`compactScrollEdgeAppearance`][Self::compactScrollEdgeAppearance].
661        #[unsafe(method(setCompactScrollEdgeAppearance:))]
662        #[unsafe(method_family = none)]
663        pub unsafe fn setCompactScrollEdgeAppearance(
664            &self,
665            compact_scroll_edge_appearance: Option<&UINavigationBarAppearance>,
666        );
667    );
668}
669
670/// Methods declared on superclass `NSObject`.
671impl UINavigationItem {
672    extern_methods!(
673        #[unsafe(method(init))]
674        #[unsafe(method_family = init)]
675        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
676
677        #[unsafe(method(new))]
678        #[unsafe(method_family = new)]
679        pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
680    );
681}