objc2_ui_kit/generated/
UITextView.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::*;
6#[cfg(feature = "objc2-core-foundation")]
7use objc2_core_foundation::*;
8use objc2_foundation::*;
9#[cfg(feature = "objc2-quartz-core")]
10#[cfg(not(target_os = "watchos"))]
11use objc2_quartz_core::*;
12
13use crate::*;
14
15extern_protocol!(
16    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uitextviewdelegate?language=objc)
17    #[cfg(feature = "UIScrollView")]
18    pub unsafe trait UITextViewDelegate:
19        NSObjectProtocol + UIScrollViewDelegate + MainThreadOnly
20    {
21        #[cfg(all(feature = "UIResponder", feature = "UIView"))]
22        #[optional]
23        #[unsafe(method(textViewShouldBeginEditing:))]
24        #[unsafe(method_family = none)]
25        unsafe fn textViewShouldBeginEditing(&self, text_view: &UITextView) -> bool;
26
27        #[cfg(all(feature = "UIResponder", feature = "UIView"))]
28        #[optional]
29        #[unsafe(method(textViewShouldEndEditing:))]
30        #[unsafe(method_family = none)]
31        unsafe fn textViewShouldEndEditing(&self, text_view: &UITextView) -> bool;
32
33        #[cfg(all(feature = "UIResponder", feature = "UIView"))]
34        #[optional]
35        #[unsafe(method(textViewDidBeginEditing:))]
36        #[unsafe(method_family = none)]
37        unsafe fn textViewDidBeginEditing(&self, text_view: &UITextView);
38
39        #[cfg(all(feature = "UIResponder", feature = "UIView"))]
40        #[optional]
41        #[unsafe(method(textViewDidEndEditing:))]
42        #[unsafe(method_family = none)]
43        unsafe fn textViewDidEndEditing(&self, text_view: &UITextView);
44
45        #[cfg(all(feature = "UIResponder", feature = "UIView"))]
46        #[optional]
47        #[unsafe(method(textView:shouldChangeTextInRange:replacementText:))]
48        #[unsafe(method_family = none)]
49        unsafe fn textView_shouldChangeTextInRange_replacementText(
50            &self,
51            text_view: &UITextView,
52            range: NSRange,
53            text: &NSString,
54        ) -> bool;
55
56        #[cfg(all(feature = "UIResponder", feature = "UIView"))]
57        #[optional]
58        #[unsafe(method(textViewDidChange:))]
59        #[unsafe(method_family = none)]
60        unsafe fn textViewDidChange(&self, text_view: &UITextView);
61
62        #[cfg(all(feature = "UIResponder", feature = "UIView"))]
63        #[optional]
64        #[unsafe(method(textViewDidChangeSelection:))]
65        #[unsafe(method_family = none)]
66        unsafe fn textViewDidChangeSelection(&self, text_view: &UITextView);
67
68        #[cfg(all(
69            feature = "UIMenu",
70            feature = "UIMenuElement",
71            feature = "UIResponder",
72            feature = "UIView"
73        ))]
74        /// Asks the delegate for the menu to be shown for the specified text range.
75        ///
76        ///
77        /// Parameter `textView`: The text view requesting the menu.
78        ///
79        /// Parameter `range`: The text range for which the menu is presented for.
80        ///
81        /// Parameter `suggestedActions`: The actions and commands that the system suggests.
82        ///
83        ///
84        /// Returns: Return a UIMenu describing the desired menu hierarchy. Return
85        /// `nil`to present the default system menu.
86        #[optional]
87        #[unsafe(method(textView:editMenuForTextInRange:suggestedActions:))]
88        #[unsafe(method_family = none)]
89        unsafe fn textView_editMenuForTextInRange_suggestedActions(
90            &self,
91            text_view: &UITextView,
92            range: NSRange,
93            suggested_actions: &NSArray<UIMenuElement>,
94        ) -> Option<Retained<UIMenu>>;
95
96        #[cfg(all(
97            feature = "UIEditMenuInteraction",
98            feature = "UIResponder",
99            feature = "UIView"
100        ))]
101        /// Called when the text view is about to present the edit menu.
102        ///
103        ///
104        /// Parameter `textView`: The text view displaying the menu.
105        ///
106        /// Parameter `animator`: Appearance animator. Add animations to this object to run them alongside the appearance transition.
107        #[optional]
108        #[unsafe(method(textView:willPresentEditMenuWithAnimator:))]
109        #[unsafe(method_family = none)]
110        unsafe fn textView_willPresentEditMenuWithAnimator(
111            &self,
112            text_view: &UITextView,
113            animator: &ProtocolObject<dyn UIEditMenuInteractionAnimating>,
114        );
115
116        #[cfg(all(
117            feature = "UIEditMenuInteraction",
118            feature = "UIResponder",
119            feature = "UIView"
120        ))]
121        /// Called when the text view is about to dismiss the edit menu.
122        ///
123        ///
124        /// Parameter `textView`: The text view displaying the menu.
125        ///
126        /// Parameter `animator`: Dismissal animator. Add animations to this object to run them alongside the dismissal transition.
127        #[optional]
128        #[unsafe(method(textView:willDismissEditMenuWithAnimator:))]
129        #[unsafe(method_family = none)]
130        unsafe fn textView_willDismissEditMenuWithAnimator(
131            &self,
132            text_view: &UITextView,
133            animator: &ProtocolObject<dyn UIEditMenuInteractionAnimating>,
134        );
135
136        #[cfg(all(
137            feature = "UIAction",
138            feature = "UIMenuElement",
139            feature = "UIResponder",
140            feature = "UITextItem",
141            feature = "UIView"
142        ))]
143        /// Asks the delegate for the action to be performed when interacting with a text item. If a nil action is provided, the text view
144        /// will request a menu to be presented on primary action if possible.
145        ///
146        ///
147        /// Parameter `textView`: The text view requesting the primary action.
148        ///
149        /// Parameter `textItem`: The text item for performing said action.
150        ///
151        /// Parameter `defaultAction`: The default action for the text item. Return this to perform the default action.
152        ///
153        ///
154        /// Returns: Return a UIAction to be performed when the text item is interacted with. Return
155        /// `nil`to prevent the action from being performed.
156        #[optional]
157        #[unsafe(method(textView:primaryActionForTextItem:defaultAction:))]
158        #[unsafe(method_family = none)]
159        unsafe fn textView_primaryActionForTextItem_defaultAction(
160            &self,
161            text_view: &UITextView,
162            text_item: &UITextItem,
163            default_action: &UIAction,
164        ) -> Option<Retained<UIAction>>;
165
166        #[cfg(all(
167            feature = "UIMenu",
168            feature = "UIMenuElement",
169            feature = "UIResponder",
170            feature = "UITextItem",
171            feature = "UIView"
172        ))]
173        /// Asks the delegate for the menu configuration to be performed when interacting with a text item.
174        ///
175        ///
176        /// Parameter `textView`: The text view requesting the menu.
177        ///
178        /// Parameter `textItem`: The text item for performing said action.
179        ///
180        /// Parameter `defaultMenu`: The default menu for the specified text item.
181        ///
182        ///
183        /// Returns: Return a menu configuration to be presented when the text item is interacted with. Return
184        /// `nil`to prevent the menu from being presented.
185        #[optional]
186        #[unsafe(method(textView:menuConfigurationForTextItem:defaultMenu:))]
187        #[unsafe(method_family = none)]
188        unsafe fn textView_menuConfigurationForTextItem_defaultMenu(
189            &self,
190            text_view: &UITextView,
191            text_item: &UITextItem,
192            default_menu: &UIMenu,
193        ) -> Option<Retained<UITextItemMenuConfiguration>>;
194
195        #[cfg(all(
196            feature = "UIContextMenuInteraction",
197            feature = "UIResponder",
198            feature = "UITextItem",
199            feature = "UIView"
200        ))]
201        /// Informs the delegate that a text item menu is about to be presented with the specified animator.
202        ///
203        ///
204        /// Parameter `textView`: The text view showing the menu.
205        ///
206        /// Parameter `textItem`: The text item for performing said action.
207        ///
208        /// Parameter `animator`: Appearance animator. Add animations to this object to run them alongside the appearance transition.
209        #[optional]
210        #[unsafe(method(textView:textItemMenuWillDisplayForTextItem:animator:))]
211        #[unsafe(method_family = none)]
212        unsafe fn textView_textItemMenuWillDisplayForTextItem_animator(
213            &self,
214            text_view: &UITextView,
215            text_item: &UITextItem,
216            animator: &ProtocolObject<dyn UIContextMenuInteractionAnimating>,
217        );
218
219        #[cfg(all(
220            feature = "UIContextMenuInteraction",
221            feature = "UIResponder",
222            feature = "UITextItem",
223            feature = "UIView"
224        ))]
225        /// Informs the delegate that a text item menu is about to be dismissed with the specified animator.
226        ///
227        ///
228        /// Parameter `textView`: The text view showing the menu.
229        ///
230        /// Parameter `textItem`: The text item for performing said action.
231        ///
232        /// Parameter `animator`: Dismissal animator. Add animations to this object to run them alongside the dismissal transition.
233        #[optional]
234        #[unsafe(method(textView:textItemMenuWillEndForTextItem:animator:))]
235        #[unsafe(method_family = none)]
236        unsafe fn textView_textItemMenuWillEndForTextItem_animator(
237            &self,
238            text_view: &UITextView,
239            text_item: &UITextItem,
240            animator: &ProtocolObject<dyn UIContextMenuInteractionAnimating>,
241        );
242
243        #[cfg(all(feature = "UIResponder", feature = "UIView"))]
244        /// Informs the delegate that Writing Tools will begin manipulating the text view
245        ///
246        ///
247        /// Parameter `textView`: The text view interacting with Writing Tools
248        #[optional]
249        #[unsafe(method(textViewWritingToolsWillBegin:))]
250        #[unsafe(method_family = none)]
251        unsafe fn textViewWritingToolsWillBegin(&self, text_view: &UITextView);
252
253        #[cfg(all(feature = "UIResponder", feature = "UIView"))]
254        /// Informs the delegate that Writing Tools has finished manipulating the text view
255        ///
256        ///
257        /// Parameter `textView`: The text view interacting with Writing Tools
258        #[optional]
259        #[unsafe(method(textViewWritingToolsDidEnd:))]
260        #[unsafe(method_family = none)]
261        unsafe fn textViewWritingToolsDidEnd(&self, text_view: &UITextView);
262
263        #[cfg(all(feature = "UIResponder", feature = "UIView"))]
264        /// Allows the delegate to specify ranges of text to be ignored by Writing Tools
265        ///
266        ///
267        /// Parameter `textView`: The text view interacting with Writing Tools
268        ///
269        /// Parameter `enclosingRange`:
270        ///
271        /// Returns: Return an array of ranges in the attributed substring of the textView storage with the enclosing range representing portions of text to be ignored by Writing Tools when evaluating the text for proofreading, summarization, rewrites, and so forth.
272        #[optional]
273        #[unsafe(method(textView:writingToolsIgnoredRangesInEnclosingRange:))]
274        #[unsafe(method_family = none)]
275        unsafe fn textView_writingToolsIgnoredRangesInEnclosingRange(
276            &self,
277            text_view: &UITextView,
278            enclosing_range: NSRange,
279        ) -> Retained<NSArray<NSValue>>;
280
281        #[cfg(all(
282            feature = "UIResponder",
283            feature = "UITextItemInteraction",
284            feature = "UIView"
285        ))]
286        #[deprecated = "Replaced by primaryActionForTextItem: and menuConfigurationForTextItem: for additional customization options."]
287        #[optional]
288        #[unsafe(method(textView:shouldInteractWithURL:inRange:interaction:))]
289        #[unsafe(method_family = none)]
290        unsafe fn textView_shouldInteractWithURL_inRange_interaction(
291            &self,
292            text_view: &UITextView,
293            url: &NSURL,
294            character_range: NSRange,
295            interaction: UITextItemInteraction,
296        ) -> bool;
297
298        #[cfg(all(
299            feature = "NSTextAttachment",
300            feature = "UIResponder",
301            feature = "UITextItemInteraction",
302            feature = "UIView"
303        ))]
304        #[deprecated = "Replaced by primaryActionForTextItem: and menuConfigurationForTextItem: for additional customization options."]
305        #[optional]
306        #[unsafe(method(textView:shouldInteractWithTextAttachment:inRange:interaction:))]
307        #[unsafe(method_family = none)]
308        unsafe fn textView_shouldInteractWithTextAttachment_inRange_interaction(
309            &self,
310            text_view: &UITextView,
311            text_attachment: &NSTextAttachment,
312            character_range: NSRange,
313            interaction: UITextItemInteraction,
314        ) -> bool;
315
316        #[cfg(all(feature = "UIResponder", feature = "UIView"))]
317        #[deprecated]
318        #[optional]
319        #[unsafe(method(textView:shouldInteractWithURL:inRange:))]
320        #[unsafe(method_family = none)]
321        unsafe fn textView_shouldInteractWithURL_inRange(
322            &self,
323            text_view: &UITextView,
324            url: &NSURL,
325            character_range: NSRange,
326        ) -> bool;
327
328        #[cfg(all(
329            feature = "NSTextAttachment",
330            feature = "UIResponder",
331            feature = "UIView"
332        ))]
333        #[deprecated]
334        #[optional]
335        #[unsafe(method(textView:shouldInteractWithTextAttachment:inRange:))]
336        #[unsafe(method_family = none)]
337        unsafe fn textView_shouldInteractWithTextAttachment_inRange(
338            &self,
339            text_view: &UITextView,
340            text_attachment: &NSTextAttachment,
341            character_range: NSRange,
342        ) -> bool;
343
344        #[cfg(all(
345            feature = "UIResponder",
346            feature = "UITextFormattingViewController",
347            feature = "UIView",
348            feature = "UIViewController"
349        ))]
350        /// Informs the delegate that text formatting controller is about to be presented.
351        ///
352        ///
353        /// Parameter `viewController`: The text formatting controller that is being presented.
354        #[optional]
355        #[unsafe(method(textView:willBeginFormattingWithViewController:))]
356        #[unsafe(method_family = none)]
357        unsafe fn textView_willBeginFormattingWithViewController(
358            &self,
359            text_view: &UITextView,
360            view_controller: &UITextFormattingViewController,
361        );
362
363        #[cfg(all(
364            feature = "UIResponder",
365            feature = "UITextFormattingViewController",
366            feature = "UIView",
367            feature = "UIViewController"
368        ))]
369        /// Informs the delegate that text formatting controller has been presented.
370        ///
371        ///
372        /// Parameter `viewController`: The text formatting controller that is being presented.
373        #[optional]
374        #[unsafe(method(textView:didBeginFormattingWithViewController:))]
375        #[unsafe(method_family = none)]
376        unsafe fn textView_didBeginFormattingWithViewController(
377            &self,
378            text_view: &UITextView,
379            view_controller: &UITextFormattingViewController,
380        );
381
382        #[cfg(all(
383            feature = "UIResponder",
384            feature = "UITextFormattingViewController",
385            feature = "UIView",
386            feature = "UIViewController"
387        ))]
388        /// Informs the delegate that text formatting controller is about to be dismissed.
389        ///
390        ///
391        /// Parameter `viewController`: The text formatting controller that is being presented.
392        #[optional]
393        #[unsafe(method(textView:willEndFormattingWithViewController:))]
394        #[unsafe(method_family = none)]
395        unsafe fn textView_willEndFormattingWithViewController(
396            &self,
397            text_view: &UITextView,
398            view_controller: &UITextFormattingViewController,
399        );
400
401        #[cfg(all(
402            feature = "UIResponder",
403            feature = "UITextFormattingViewController",
404            feature = "UIView",
405            feature = "UIViewController"
406        ))]
407        /// Informs the delegate that text formatting controller has been dismissed.
408        ///
409        ///
410        /// Parameter `viewController`: The text formatting controller that is being presented.
411        #[optional]
412        #[unsafe(method(textView:didEndFormattingWithViewController:))]
413        #[unsafe(method_family = none)]
414        unsafe fn textView_didEndFormattingWithViewController(
415            &self,
416            text_view: &UITextView,
417            view_controller: &UITextFormattingViewController,
418        );
419
420        #[cfg(all(
421            feature = "UIInputSuggestion",
422            feature = "UIResponder",
423            feature = "UIView"
424        ))]
425        /// Tells the delegate when the keyboard delivers an input suggestion.
426        ///
427        /// - Parameters:
428        /// - textView: The text view that is currently the first responder.
429        /// - inputSuggestion: The input suggestion that the user or system selected.
430        #[optional]
431        #[unsafe(method(textView:insertInputSuggestion:))]
432        #[unsafe(method_family = none)]
433        unsafe fn textView_insertInputSuggestion(
434            &self,
435            text_view: &UITextView,
436            input_suggestion: &UIInputSuggestion,
437        );
438    }
439);
440
441/// The type of border around the text view.
442///
443/// See also [Apple's documentation](https://developer.apple.com/documentation/uikit/uitextviewborderstyle?language=objc)
444// NS_ENUM
445#[repr(transparent)]
446#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
447pub struct UITextViewBorderStyle(pub NSInteger);
448impl UITextViewBorderStyle {
449    /// The text view does not display a border.
450    #[doc(alias = "UITextViewBorderStyleNone")]
451    pub const None: Self = Self(0);
452    /// Displays a rounded-style border for the text view.
453    #[doc(alias = "UITextViewBorderStyleRoundedRect")]
454    pub const RoundedRect: Self = Self(1);
455}
456
457unsafe impl Encode for UITextViewBorderStyle {
458    const ENCODING: Encoding = NSInteger::ENCODING;
459}
460
461unsafe impl RefEncode for UITextViewBorderStyle {
462    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
463}
464
465extern_class!(
466    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uitextview?language=objc)
467    #[unsafe(super(UIScrollView, UIView, UIResponder, NSObject))]
468    #[thread_kind = MainThreadOnly]
469    #[derive(Debug, PartialEq, Eq, Hash)]
470    #[cfg(all(feature = "UIResponder", feature = "UIScrollView", feature = "UIView"))]
471    pub struct UITextView;
472);
473
474#[cfg(all(
475    feature = "UIResponder",
476    feature = "UIScrollView",
477    feature = "UIView",
478    feature = "objc2-quartz-core"
479))]
480#[cfg(not(target_os = "watchos"))]
481extern_conformance!(
482    unsafe impl CALayerDelegate for UITextView {}
483);
484
485#[cfg(all(feature = "UIResponder", feature = "UIScrollView", feature = "UIView"))]
486extern_conformance!(
487    unsafe impl NSCoding for UITextView {}
488);
489
490#[cfg(all(feature = "UIResponder", feature = "UIScrollView", feature = "UIView"))]
491extern_conformance!(
492    unsafe impl NSObjectProtocol for UITextView {}
493);
494
495#[cfg(all(
496    feature = "UIAppearance",
497    feature = "UIResponder",
498    feature = "UIScrollView",
499    feature = "UIView"
500))]
501extern_conformance!(
502    unsafe impl UIAppearance for UITextView {}
503);
504
505#[cfg(all(
506    feature = "UIAppearance",
507    feature = "UIResponder",
508    feature = "UIScrollView",
509    feature = "UIView"
510))]
511extern_conformance!(
512    unsafe impl UIAppearanceContainer for UITextView {}
513);
514
515#[cfg(all(
516    feature = "UIContentSizeCategoryAdjusting",
517    feature = "UIResponder",
518    feature = "UIScrollView",
519    feature = "UIView"
520))]
521extern_conformance!(
522    unsafe impl UIContentSizeCategoryAdjusting for UITextView {}
523);
524
525#[cfg(all(feature = "UIResponder", feature = "UIScrollView", feature = "UIView"))]
526extern_conformance!(
527    unsafe impl UICoordinateSpace for UITextView {}
528);
529
530#[cfg(all(
531    feature = "UIDynamicBehavior",
532    feature = "UIResponder",
533    feature = "UIScrollView",
534    feature = "UIView"
535))]
536extern_conformance!(
537    unsafe impl UIDynamicItem for UITextView {}
538);
539
540#[cfg(all(
541    feature = "UIFocus",
542    feature = "UIResponder",
543    feature = "UIScrollView",
544    feature = "UIView"
545))]
546extern_conformance!(
547    unsafe impl UIFocusEnvironment for UITextView {}
548);
549
550#[cfg(all(
551    feature = "UIFocus",
552    feature = "UIResponder",
553    feature = "UIScrollView",
554    feature = "UIView"
555))]
556extern_conformance!(
557    unsafe impl UIFocusItem for UITextView {}
558);
559
560#[cfg(all(
561    feature = "UIFocus",
562    feature = "UIResponder",
563    feature = "UIScrollView",
564    feature = "UIView"
565))]
566extern_conformance!(
567    unsafe impl UIFocusItemContainer for UITextView {}
568);
569
570#[cfg(all(
571    feature = "UIFocus",
572    feature = "UIResponder",
573    feature = "UIScrollView",
574    feature = "UIView"
575))]
576extern_conformance!(
577    unsafe impl UIFocusItemScrollableContainer for UITextView {}
578);
579
580#[cfg(all(
581    feature = "UIResponder",
582    feature = "UIScrollView",
583    feature = "UITextInput",
584    feature = "UITextInputTraits",
585    feature = "UIView"
586))]
587extern_conformance!(
588    unsafe impl UIKeyInput for UITextView {}
589);
590
591#[cfg(all(
592    feature = "UILetterformAwareAdjusting",
593    feature = "UIResponder",
594    feature = "UIScrollView",
595    feature = "UIView"
596))]
597extern_conformance!(
598    unsafe impl UILetterformAwareAdjusting for UITextView {}
599);
600
601#[cfg(all(feature = "UIResponder", feature = "UIScrollView", feature = "UIView"))]
602extern_conformance!(
603    unsafe impl UIResponderStandardEditActions for UITextView {}
604);
605
606#[cfg(all(
607    feature = "UIResponder",
608    feature = "UIScrollView",
609    feature = "UITextInput",
610    feature = "UITextInputTraits",
611    feature = "UIView"
612))]
613extern_conformance!(
614    unsafe impl UITextInput for UITextView {}
615);
616
617#[cfg(all(
618    feature = "UIResponder",
619    feature = "UIScrollView",
620    feature = "UITextInputTraits",
621    feature = "UIView"
622))]
623extern_conformance!(
624    unsafe impl UITextInputTraits for UITextView {}
625);
626
627#[cfg(all(
628    feature = "UIResponder",
629    feature = "UIScrollView",
630    feature = "UITraitCollection",
631    feature = "UIView"
632))]
633extern_conformance!(
634    unsafe impl UITraitEnvironment for UITextView {}
635);
636
637#[cfg(all(feature = "UIResponder", feature = "UIScrollView", feature = "UIView"))]
638impl UITextView {
639    extern_methods!(
640        #[unsafe(method(delegate))]
641        #[unsafe(method_family = none)]
642        pub unsafe fn delegate(&self) -> Option<Retained<ProtocolObject<dyn UITextViewDelegate>>>;
643
644        /// This is a [weak property][objc2::topics::weak_property].
645        /// Setter for [`delegate`][Self::delegate].
646        #[unsafe(method(setDelegate:))]
647        #[unsafe(method_family = none)]
648        pub unsafe fn setDelegate(&self, delegate: Option<&ProtocolObject<dyn UITextViewDelegate>>);
649
650        #[unsafe(method(text))]
651        #[unsafe(method_family = none)]
652        pub unsafe fn text(&self) -> Retained<NSString>;
653
654        /// Setter for [`text`][Self::text].
655        #[unsafe(method(setText:))]
656        #[unsafe(method_family = none)]
657        pub unsafe fn setText(&self, text: Option<&NSString>);
658
659        #[cfg(feature = "UIFont")]
660        #[unsafe(method(font))]
661        #[unsafe(method_family = none)]
662        pub unsafe fn font(&self) -> Option<Retained<UIFont>>;
663
664        #[cfg(feature = "UIFont")]
665        /// Setter for [`font`][Self::font].
666        #[unsafe(method(setFont:))]
667        #[unsafe(method_family = none)]
668        pub unsafe fn setFont(&self, font: Option<&UIFont>);
669
670        #[cfg(feature = "UIColor")]
671        #[unsafe(method(textColor))]
672        #[unsafe(method_family = none)]
673        pub unsafe fn textColor(&self) -> Option<Retained<UIColor>>;
674
675        #[cfg(feature = "UIColor")]
676        /// Setter for [`textColor`][Self::textColor].
677        #[unsafe(method(setTextColor:))]
678        #[unsafe(method_family = none)]
679        pub unsafe fn setTextColor(&self, text_color: Option<&UIColor>);
680
681        #[cfg(feature = "NSText")]
682        #[unsafe(method(textAlignment))]
683        #[unsafe(method_family = none)]
684        pub unsafe fn textAlignment(&self) -> NSTextAlignment;
685
686        #[cfg(feature = "NSText")]
687        /// Setter for [`textAlignment`][Self::textAlignment].
688        #[unsafe(method(setTextAlignment:))]
689        #[unsafe(method_family = none)]
690        pub unsafe fn setTextAlignment(&self, text_alignment: NSTextAlignment);
691
692        #[unsafe(method(selectedRange))]
693        #[unsafe(method_family = none)]
694        pub unsafe fn selectedRange(&self) -> NSRange;
695
696        /// Setter for [`selectedRange`][Self::selectedRange].
697        #[unsafe(method(setSelectedRange:))]
698        #[unsafe(method_family = none)]
699        pub unsafe fn setSelectedRange(&self, selected_range: NSRange);
700
701        #[unsafe(method(isEditable))]
702        #[unsafe(method_family = none)]
703        pub unsafe fn isEditable(&self) -> bool;
704
705        /// Setter for [`isEditable`][Self::isEditable].
706        #[unsafe(method(setEditable:))]
707        #[unsafe(method_family = none)]
708        pub unsafe fn setEditable(&self, editable: bool);
709
710        #[unsafe(method(isSelectable))]
711        #[unsafe(method_family = none)]
712        pub unsafe fn isSelectable(&self) -> bool;
713
714        /// Setter for [`isSelectable`][Self::isSelectable].
715        #[unsafe(method(setSelectable:))]
716        #[unsafe(method_family = none)]
717        pub unsafe fn setSelectable(&self, selectable: bool);
718
719        #[cfg(feature = "UIDataDetectors")]
720        #[unsafe(method(dataDetectorTypes))]
721        #[unsafe(method_family = none)]
722        pub unsafe fn dataDetectorTypes(&self) -> UIDataDetectorTypes;
723
724        #[cfg(feature = "UIDataDetectors")]
725        /// Setter for [`dataDetectorTypes`][Self::dataDetectorTypes].
726        #[unsafe(method(setDataDetectorTypes:))]
727        #[unsafe(method_family = none)]
728        pub unsafe fn setDataDetectorTypes(&self, data_detector_types: UIDataDetectorTypes);
729
730        #[unsafe(method(allowsEditingTextAttributes))]
731        #[unsafe(method_family = none)]
732        pub unsafe fn allowsEditingTextAttributes(&self) -> bool;
733
734        /// Setter for [`allowsEditingTextAttributes`][Self::allowsEditingTextAttributes].
735        #[unsafe(method(setAllowsEditingTextAttributes:))]
736        #[unsafe(method_family = none)]
737        pub unsafe fn setAllowsEditingTextAttributes(&self, allows_editing_text_attributes: bool);
738
739        #[unsafe(method(attributedText))]
740        #[unsafe(method_family = none)]
741        pub unsafe fn attributedText(&self) -> Retained<NSAttributedString>;
742
743        /// Setter for [`attributedText`][Self::attributedText].
744        #[unsafe(method(setAttributedText:))]
745        #[unsafe(method_family = none)]
746        pub unsafe fn setAttributedText(&self, attributed_text: Option<&NSAttributedString>);
747
748        #[unsafe(method(typingAttributes))]
749        #[unsafe(method_family = none)]
750        pub unsafe fn typingAttributes(
751            &self,
752        ) -> Retained<NSDictionary<NSAttributedStringKey, AnyObject>>;
753
754        /// Setter for [`typingAttributes`][Self::typingAttributes].
755        #[unsafe(method(setTypingAttributes:))]
756        #[unsafe(method_family = none)]
757        pub unsafe fn setTypingAttributes(
758            &self,
759            typing_attributes: &NSDictionary<NSAttributedStringKey, AnyObject>,
760        );
761
762        #[unsafe(method(scrollRangeToVisible:))]
763        #[unsafe(method_family = none)]
764        pub unsafe fn scrollRangeToVisible(&self, range: NSRange);
765
766        #[unsafe(method(inputView))]
767        #[unsafe(method_family = none)]
768        pub unsafe fn inputView(&self) -> Option<Retained<UIView>>;
769
770        /// Setter for [`inputView`][Self::inputView].
771        #[unsafe(method(setInputView:))]
772        #[unsafe(method_family = none)]
773        pub unsafe fn setInputView(&self, input_view: Option<&UIView>);
774
775        #[unsafe(method(inputAccessoryView))]
776        #[unsafe(method_family = none)]
777        pub unsafe fn inputAccessoryView(&self) -> Option<Retained<UIView>>;
778
779        /// Setter for [`inputAccessoryView`][Self::inputAccessoryView].
780        #[unsafe(method(setInputAccessoryView:))]
781        #[unsafe(method_family = none)]
782        pub unsafe fn setInputAccessoryView(&self, input_accessory_view: Option<&UIView>);
783
784        #[unsafe(method(clearsOnInsertion))]
785        #[unsafe(method_family = none)]
786        pub unsafe fn clearsOnInsertion(&self) -> bool;
787
788        /// Setter for [`clearsOnInsertion`][Self::clearsOnInsertion].
789        #[unsafe(method(setClearsOnInsertion:))]
790        #[unsafe(method_family = none)]
791        pub unsafe fn setClearsOnInsertion(&self, clears_on_insertion: bool);
792
793        #[cfg(all(feature = "NSTextContainer", feature = "objc2-core-foundation"))]
794        #[unsafe(method(initWithFrame:textContainer:))]
795        #[unsafe(method_family = init)]
796        pub unsafe fn initWithFrame_textContainer(
797            this: Allocated<Self>,
798            frame: CGRect,
799            text_container: Option<&NSTextContainer>,
800        ) -> Retained<Self>;
801
802        #[unsafe(method(textViewUsingTextLayoutManager:))]
803        #[unsafe(method_family = none)]
804        pub unsafe fn textViewUsingTextLayoutManager(
805            using_text_layout_manager: bool,
806            mtm: MainThreadMarker,
807        ) -> Retained<Self>;
808
809        #[unsafe(method(initWithCoder:))]
810        #[unsafe(method_family = init)]
811        pub unsafe fn initWithCoder(
812            this: Allocated<Self>,
813            coder: &NSCoder,
814        ) -> Option<Retained<Self>>;
815
816        #[cfg(feature = "NSTextContainer")]
817        #[unsafe(method(textContainer))]
818        #[unsafe(method_family = none)]
819        pub unsafe fn textContainer(&self) -> Retained<NSTextContainer>;
820
821        #[cfg(all(feature = "UIGeometry", feature = "objc2-core-foundation"))]
822        #[unsafe(method(textContainerInset))]
823        #[unsafe(method_family = none)]
824        pub unsafe fn textContainerInset(&self) -> UIEdgeInsets;
825
826        #[cfg(all(feature = "UIGeometry", feature = "objc2-core-foundation"))]
827        /// Setter for [`textContainerInset`][Self::textContainerInset].
828        #[unsafe(method(setTextContainerInset:))]
829        #[unsafe(method_family = none)]
830        pub unsafe fn setTextContainerInset(&self, text_container_inset: UIEdgeInsets);
831
832        #[cfg(feature = "NSTextLayoutManager")]
833        #[unsafe(method(textLayoutManager))]
834        #[unsafe(method_family = none)]
835        pub unsafe fn textLayoutManager(&self) -> Option<Retained<NSTextLayoutManager>>;
836
837        #[cfg(feature = "NSLayoutManager")]
838        #[unsafe(method(layoutManager))]
839        #[unsafe(method_family = none)]
840        pub unsafe fn layoutManager(&self) -> Retained<NSLayoutManager>;
841
842        #[cfg(feature = "NSTextStorage")]
843        #[unsafe(method(textStorage))]
844        #[unsafe(method_family = none)]
845        pub unsafe fn textStorage(&self) -> Retained<NSTextStorage>;
846
847        #[unsafe(method(linkTextAttributes))]
848        #[unsafe(method_family = none)]
849        pub unsafe fn linkTextAttributes(
850            &self,
851        ) -> Retained<NSDictionary<NSAttributedStringKey, AnyObject>>;
852
853        /// Setter for [`linkTextAttributes`][Self::linkTextAttributes].
854        #[unsafe(method(setLinkTextAttributes:))]
855        #[unsafe(method_family = none)]
856        pub unsafe fn setLinkTextAttributes(
857            &self,
858            link_text_attributes: Option<&NSDictionary<NSAttributedStringKey, AnyObject>>,
859        );
860
861        #[unsafe(method(usesStandardTextScaling))]
862        #[unsafe(method_family = none)]
863        pub unsafe fn usesStandardTextScaling(&self) -> bool;
864
865        /// Setter for [`usesStandardTextScaling`][Self::usesStandardTextScaling].
866        #[unsafe(method(setUsesStandardTextScaling:))]
867        #[unsafe(method_family = none)]
868        pub unsafe fn setUsesStandardTextScaling(&self, uses_standard_text_scaling: bool);
869
870        #[cfg(feature = "UIFindInteraction")]
871        /// If `findInteractionEnabled` is set to true, returns this text view's built-in find interaction. Otherwise, nil.
872        #[unsafe(method(findInteraction))]
873        #[unsafe(method_family = none)]
874        pub unsafe fn findInteraction(&self) -> Option<Retained<UIFindInteraction>>;
875
876        /// Enables this text view's built-in find interaction.
877        #[unsafe(method(isFindInteractionEnabled))]
878        #[unsafe(method_family = none)]
879        pub unsafe fn isFindInteractionEnabled(&self) -> bool;
880
881        /// Setter for [`isFindInteractionEnabled`][Self::isFindInteractionEnabled].
882        #[unsafe(method(setFindInteractionEnabled:))]
883        #[unsafe(method_family = none)]
884        pub unsafe fn setFindInteractionEnabled(&self, find_interaction_enabled: bool);
885
886        /// The border style for the text field.
887        #[unsafe(method(borderStyle))]
888        #[unsafe(method_family = none)]
889        pub unsafe fn borderStyle(&self) -> UITextViewBorderStyle;
890
891        /// Setter for [`borderStyle`][Self::borderStyle].
892        #[unsafe(method(setBorderStyle:))]
893        #[unsafe(method_family = none)]
894        pub unsafe fn setBorderStyle(&self, border_style: UITextViewBorderStyle);
895
896        #[unsafe(method(textHighlightAttributes))]
897        #[unsafe(method_family = none)]
898        pub unsafe fn textHighlightAttributes(
899            &self,
900        ) -> Retained<NSDictionary<NSAttributedStringKey, AnyObject>>;
901
902        /// Setter for [`textHighlightAttributes`][Self::textHighlightAttributes].
903        #[unsafe(method(setTextHighlightAttributes:))]
904        #[unsafe(method_family = none)]
905        pub unsafe fn setTextHighlightAttributes(
906            &self,
907            text_highlight_attributes: Option<&NSDictionary<NSAttributedStringKey, AnyObject>>,
908        );
909
910        #[cfg(all(feature = "NSTextRange", feature = "objc2-core-foundation"))]
911        #[unsafe(method(drawTextHighlightBackgroundForTextRange:origin:))]
912        #[unsafe(method_family = none)]
913        pub unsafe fn drawTextHighlightBackgroundForTextRange_origin(
914            &self,
915            text_range: &NSTextRange,
916            origin: CGPoint,
917        );
918
919        /// Convenience for tracking whether Writing Tools is active
920        ///
921        ///
922        /// Returns: Returns
923        /// `YES`while Writing Tools is interacting with the receiver (after
924        /// `-textViewWritingToolsWillBegin:`completes until
925        /// `-textViewWritingToolsDidEnd:`completes)
926        #[unsafe(method(isWritingToolsActive))]
927        #[unsafe(method_family = none)]
928        pub unsafe fn isWritingToolsActive(&self) -> bool;
929
930        #[cfg(feature = "UITextInputTraits")]
931        #[unsafe(method(writingToolsBehavior))]
932        #[unsafe(method_family = none)]
933        pub unsafe fn writingToolsBehavior(&self) -> UIWritingToolsBehavior;
934
935        #[cfg(feature = "UITextInputTraits")]
936        /// Setter for [`writingToolsBehavior`][Self::writingToolsBehavior].
937        #[unsafe(method(setWritingToolsBehavior:))]
938        #[unsafe(method_family = none)]
939        pub unsafe fn setWritingToolsBehavior(
940            &self,
941            writing_tools_behavior: UIWritingToolsBehavior,
942        );
943
944        #[cfg(feature = "UITextInputTraits")]
945        #[unsafe(method(allowedWritingToolsResultOptions))]
946        #[unsafe(method_family = none)]
947        pub unsafe fn allowedWritingToolsResultOptions(&self) -> UIWritingToolsResultOptions;
948
949        #[cfg(feature = "UITextInputTraits")]
950        /// Setter for [`allowedWritingToolsResultOptions`][Self::allowedWritingToolsResultOptions].
951        #[unsafe(method(setAllowedWritingToolsResultOptions:))]
952        #[unsafe(method_family = none)]
953        pub unsafe fn setAllowedWritingToolsResultOptions(
954            &self,
955            allowed_writing_tools_result_options: UIWritingToolsResultOptions,
956        );
957
958        #[unsafe(method(subclassForWritingToolsCoordinator))]
959        #[unsafe(method_family = none)]
960        pub unsafe fn subclassForWritingToolsCoordinator(&self) -> &'static AnyClass;
961
962        #[cfg(feature = "UIWritingToolsCoordinator")]
963        #[unsafe(method(writingToolsCoordinator))]
964        #[unsafe(method_family = none)]
965        pub unsafe fn writingToolsCoordinator(&self) -> Retained<UIWritingToolsCoordinator>;
966
967        #[cfg(feature = "UITextFormattingViewControllerConfiguration")]
968        /// For text views that have flag `allowsEditingTextAttributes` set,
969        /// this configuration will be used for `UITextFormattingViewController`
970        /// when its presentation is requested.
971        ///
972        /// It has a non-nil default value.
973        #[unsafe(method(textFormattingConfiguration))]
974        #[unsafe(method_family = none)]
975        pub unsafe fn textFormattingConfiguration(
976            &self,
977        ) -> Option<Retained<UITextFormattingViewControllerConfiguration>>;
978
979        #[cfg(feature = "UITextFormattingViewControllerConfiguration")]
980        /// Setter for [`textFormattingConfiguration`][Self::textFormattingConfiguration].
981        #[unsafe(method(setTextFormattingConfiguration:))]
982        #[unsafe(method_family = none)]
983        pub unsafe fn setTextFormattingConfiguration(
984            &self,
985            text_formatting_configuration: Option<&UITextFormattingViewControllerConfiguration>,
986        );
987    );
988}
989
990/// Methods declared on superclass `UIView`.
991#[cfg(all(feature = "UIResponder", feature = "UIScrollView", feature = "UIView"))]
992impl UITextView {
993    extern_methods!(
994        #[cfg(feature = "objc2-core-foundation")]
995        #[unsafe(method(initWithFrame:))]
996        #[unsafe(method_family = init)]
997        pub unsafe fn initWithFrame(this: Allocated<Self>, frame: CGRect) -> Retained<Self>;
998    );
999}
1000
1001/// Methods declared on superclass `NSObject`.
1002#[cfg(all(feature = "UIResponder", feature = "UIScrollView", feature = "UIView"))]
1003impl UITextView {
1004    extern_methods!(
1005        #[unsafe(method(init))]
1006        #[unsafe(method_family = init)]
1007        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
1008
1009        #[unsafe(method(new))]
1010        #[unsafe(method_family = new)]
1011        pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
1012    );
1013}
1014
1015#[cfg(all(feature = "UIResponder", feature = "UIScrollView", feature = "UIView"))]
1016impl UITextView {
1017    extern_methods!();
1018}
1019
1020#[cfg(all(
1021    feature = "UIFindInteraction",
1022    feature = "UIResponder",
1023    feature = "UIScrollView",
1024    feature = "UIView"
1025))]
1026extern_conformance!(
1027    unsafe impl UIFindInteractionDelegate for UITextView {}
1028);
1029
1030#[cfg(all(
1031    feature = "UIResponder",
1032    feature = "UIScrollView",
1033    feature = "UITextDragging",
1034    feature = "UITextInput",
1035    feature = "UITextInputTraits",
1036    feature = "UIView"
1037))]
1038extern_conformance!(
1039    unsafe impl UITextDraggable for UITextView {}
1040);
1041
1042#[cfg(all(
1043    feature = "UIPasteConfigurationSupporting",
1044    feature = "UIResponder",
1045    feature = "UIScrollView",
1046    feature = "UITextDropping",
1047    feature = "UITextInput",
1048    feature = "UITextInputTraits",
1049    feature = "UITextPasteConfigurationSupporting",
1050    feature = "UIView"
1051))]
1052extern_conformance!(
1053    unsafe impl UITextDroppable for UITextView {}
1054);
1055
1056#[cfg(all(
1057    feature = "UIPasteConfigurationSupporting",
1058    feature = "UIResponder",
1059    feature = "UIScrollView",
1060    feature = "UITextPasteConfigurationSupporting",
1061    feature = "UIView"
1062))]
1063extern_conformance!(
1064    unsafe impl UITextPasteConfigurationSupporting for UITextView {}
1065);
1066
1067#[cfg(all(
1068    feature = "UIResponder",
1069    feature = "UIScrollView",
1070    feature = "UITextSearching",
1071    feature = "UIView"
1072))]
1073extern_conformance!(
1074    unsafe impl UITextSearching for UITextView {}
1075);
1076
1077/// UIInteractionStateRestorable.
1078#[cfg(all(feature = "UIResponder", feature = "UIScrollView", feature = "UIView"))]
1079impl UITextView {
1080    extern_methods!(
1081        #[unsafe(method(interactionState))]
1082        #[unsafe(method_family = none)]
1083        pub unsafe fn interactionState(&self) -> Retained<AnyObject>;
1084
1085        /// Setter for [`interactionState`][Self::interactionState].
1086        #[unsafe(method(setInteractionState:))]
1087        #[unsafe(method_family = none)]
1088        pub unsafe fn setInteractionState(&self, interaction_state: &AnyObject);
1089    );
1090}
1091
1092extern "C" {
1093    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uitextviewtextdidbegineditingnotification?language=objc)
1094    pub static UITextViewTextDidBeginEditingNotification: &'static NSNotificationName;
1095}
1096
1097extern "C" {
1098    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uitextviewtextdidchangenotification?language=objc)
1099    pub static UITextViewTextDidChangeNotification: &'static NSNotificationName;
1100}
1101
1102extern "C" {
1103    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uitextviewtextdidendeditingnotification?language=objc)
1104    pub static UITextViewTextDidEndEditingNotification: &'static NSNotificationName;
1105}