1use 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
15#[repr(transparent)]
18#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
19pub struct UITextBorderStyle(pub NSInteger);
20impl UITextBorderStyle {
21 #[doc(alias = "UITextBorderStyleNone")]
22 pub const None: Self = Self(0);
23 #[doc(alias = "UITextBorderStyleLine")]
24 pub const Line: Self = Self(1);
25 #[doc(alias = "UITextBorderStyleBezel")]
26 pub const Bezel: Self = Self(2);
27 #[doc(alias = "UITextBorderStyleRoundedRect")]
28 pub const RoundedRect: Self = Self(3);
29}
30
31unsafe impl Encode for UITextBorderStyle {
32 const ENCODING: Encoding = NSInteger::ENCODING;
33}
34
35unsafe impl RefEncode for UITextBorderStyle {
36 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
37}
38
39#[repr(transparent)]
42#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
43pub struct UITextFieldViewMode(pub NSInteger);
44impl UITextFieldViewMode {
45 #[doc(alias = "UITextFieldViewModeNever")]
46 pub const Never: Self = Self(0);
47 #[doc(alias = "UITextFieldViewModeWhileEditing")]
48 pub const WhileEditing: Self = Self(1);
49 #[doc(alias = "UITextFieldViewModeUnlessEditing")]
50 pub const UnlessEditing: Self = Self(2);
51 #[doc(alias = "UITextFieldViewModeAlways")]
52 pub const Always: Self = Self(3);
53}
54
55unsafe impl Encode for UITextFieldViewMode {
56 const ENCODING: Encoding = NSInteger::ENCODING;
57}
58
59unsafe impl RefEncode for UITextFieldViewMode {
60 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
61}
62
63#[repr(transparent)]
66#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
67pub struct UITextFieldDidEndEditingReason(pub NSInteger);
68impl UITextFieldDidEndEditingReason {
69 #[doc(alias = "UITextFieldDidEndEditingReasonCommitted")]
70 pub const Committed: Self = Self(0);
71 #[doc(alias = "UITextFieldDidEndEditingReasonCancelled")]
72 pub const Cancelled: Self = Self(1);
73}
74
75unsafe impl Encode for UITextFieldDidEndEditingReason {
76 const ENCODING: Encoding = NSInteger::ENCODING;
77}
78
79unsafe impl RefEncode for UITextFieldDidEndEditingReason {
80 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
81}
82
83extern_class!(
84 #[unsafe(super(UIControl, UIView, UIResponder, NSObject))]
86 #[thread_kind = MainThreadOnly]
87 #[derive(Debug, PartialEq, Eq, Hash)]
88 #[cfg(all(feature = "UIControl", feature = "UIResponder", feature = "UIView"))]
89 pub struct UITextField;
90);
91
92#[cfg(all(
93 feature = "UIControl",
94 feature = "UIResponder",
95 feature = "UIView",
96 feature = "objc2-quartz-core"
97))]
98#[cfg(not(target_os = "watchos"))]
99extern_conformance!(
100 unsafe impl CALayerDelegate for UITextField {}
101);
102
103#[cfg(all(feature = "UIControl", feature = "UIResponder", feature = "UIView"))]
104extern_conformance!(
105 unsafe impl NSCoding for UITextField {}
106);
107
108#[cfg(all(feature = "UIControl", feature = "UIResponder", feature = "UIView"))]
109extern_conformance!(
110 unsafe impl NSObjectProtocol for UITextField {}
111);
112
113#[cfg(all(
114 feature = "UIAppearance",
115 feature = "UIControl",
116 feature = "UIResponder",
117 feature = "UIView"
118))]
119extern_conformance!(
120 unsafe impl UIAppearance for UITextField {}
121);
122
123#[cfg(all(
124 feature = "UIAppearance",
125 feature = "UIControl",
126 feature = "UIResponder",
127 feature = "UIView"
128))]
129extern_conformance!(
130 unsafe impl UIAppearanceContainer for UITextField {}
131);
132
133#[cfg(all(
134 feature = "UIContentSizeCategoryAdjusting",
135 feature = "UIControl",
136 feature = "UIResponder",
137 feature = "UIView"
138))]
139extern_conformance!(
140 unsafe impl UIContentSizeCategoryAdjusting for UITextField {}
141);
142
143#[cfg(all(feature = "UIControl", feature = "UIResponder", feature = "UIView"))]
144extern_conformance!(
145 unsafe impl UICoordinateSpace for UITextField {}
146);
147
148#[cfg(all(
149 feature = "UIControl",
150 feature = "UIDynamicBehavior",
151 feature = "UIResponder",
152 feature = "UIView"
153))]
154extern_conformance!(
155 unsafe impl UIDynamicItem for UITextField {}
156);
157
158#[cfg(all(
159 feature = "UIControl",
160 feature = "UIFocus",
161 feature = "UIResponder",
162 feature = "UIView"
163))]
164extern_conformance!(
165 unsafe impl UIFocusEnvironment for UITextField {}
166);
167
168#[cfg(all(
169 feature = "UIControl",
170 feature = "UIFocus",
171 feature = "UIResponder",
172 feature = "UIView"
173))]
174extern_conformance!(
175 unsafe impl UIFocusItem for UITextField {}
176);
177
178#[cfg(all(
179 feature = "UIControl",
180 feature = "UIFocus",
181 feature = "UIResponder",
182 feature = "UIView"
183))]
184extern_conformance!(
185 unsafe impl UIFocusItemContainer for UITextField {}
186);
187
188#[cfg(all(
189 feature = "UIControl",
190 feature = "UIResponder",
191 feature = "UITextInput",
192 feature = "UITextInputTraits",
193 feature = "UIView"
194))]
195extern_conformance!(
196 unsafe impl UIKeyInput for UITextField {}
197);
198
199#[cfg(all(
200 feature = "UIControl",
201 feature = "UILetterformAwareAdjusting",
202 feature = "UIResponder",
203 feature = "UIView"
204))]
205extern_conformance!(
206 unsafe impl UILetterformAwareAdjusting for UITextField {}
207);
208
209#[cfg(all(feature = "UIControl", feature = "UIResponder", feature = "UIView"))]
210extern_conformance!(
211 unsafe impl UIResponderStandardEditActions for UITextField {}
212);
213
214#[cfg(all(
215 feature = "UIControl",
216 feature = "UIResponder",
217 feature = "UITextInput",
218 feature = "UITextInputTraits",
219 feature = "UIView"
220))]
221extern_conformance!(
222 unsafe impl UITextInput for UITextField {}
223);
224
225#[cfg(all(
226 feature = "UIControl",
227 feature = "UIResponder",
228 feature = "UITextInputTraits",
229 feature = "UIView"
230))]
231extern_conformance!(
232 unsafe impl UITextInputTraits for UITextField {}
233);
234
235#[cfg(all(
236 feature = "UIControl",
237 feature = "UIResponder",
238 feature = "UITraitCollection",
239 feature = "UIView"
240))]
241extern_conformance!(
242 unsafe impl UITraitEnvironment for UITextField {}
243);
244
245#[cfg(all(feature = "UIControl", feature = "UIResponder", feature = "UIView"))]
246impl UITextField {
247 extern_methods!(
248 #[unsafe(method(text))]
249 #[unsafe(method_family = none)]
250 pub unsafe fn text(&self) -> Option<Retained<NSString>>;
251
252 #[unsafe(method(setText:))]
254 #[unsafe(method_family = none)]
255 pub unsafe fn setText(&self, text: Option<&NSString>);
256
257 #[unsafe(method(attributedText))]
258 #[unsafe(method_family = none)]
259 pub unsafe fn attributedText(&self) -> Option<Retained<NSAttributedString>>;
260
261 #[unsafe(method(setAttributedText:))]
263 #[unsafe(method_family = none)]
264 pub unsafe fn setAttributedText(&self, attributed_text: Option<&NSAttributedString>);
265
266 #[cfg(feature = "UIColor")]
267 #[unsafe(method(textColor))]
268 #[unsafe(method_family = none)]
269 pub unsafe fn textColor(&self) -> Option<Retained<UIColor>>;
270
271 #[cfg(feature = "UIColor")]
272 #[unsafe(method(setTextColor:))]
274 #[unsafe(method_family = none)]
275 pub unsafe fn setTextColor(&self, text_color: Option<&UIColor>);
276
277 #[cfg(feature = "UIFont")]
278 #[unsafe(method(font))]
279 #[unsafe(method_family = none)]
280 pub unsafe fn font(&self) -> Option<Retained<UIFont>>;
281
282 #[cfg(feature = "UIFont")]
283 #[unsafe(method(setFont:))]
285 #[unsafe(method_family = none)]
286 pub unsafe fn setFont(&self, font: Option<&UIFont>);
287
288 #[cfg(feature = "NSText")]
289 #[unsafe(method(textAlignment))]
290 #[unsafe(method_family = none)]
291 pub unsafe fn textAlignment(&self) -> NSTextAlignment;
292
293 #[cfg(feature = "NSText")]
294 #[unsafe(method(setTextAlignment:))]
296 #[unsafe(method_family = none)]
297 pub unsafe fn setTextAlignment(&self, text_alignment: NSTextAlignment);
298
299 #[unsafe(method(borderStyle))]
300 #[unsafe(method_family = none)]
301 pub unsafe fn borderStyle(&self) -> UITextBorderStyle;
302
303 #[unsafe(method(setBorderStyle:))]
305 #[unsafe(method_family = none)]
306 pub unsafe fn setBorderStyle(&self, border_style: UITextBorderStyle);
307
308 #[unsafe(method(defaultTextAttributes))]
309 #[unsafe(method_family = none)]
310 pub unsafe fn defaultTextAttributes(
311 &self,
312 ) -> Retained<NSDictionary<NSAttributedStringKey, AnyObject>>;
313
314 #[unsafe(method(setDefaultTextAttributes:))]
316 #[unsafe(method_family = none)]
317 pub unsafe fn setDefaultTextAttributes(
318 &self,
319 default_text_attributes: &NSDictionary<NSAttributedStringKey, AnyObject>,
320 );
321
322 #[unsafe(method(placeholder))]
323 #[unsafe(method_family = none)]
324 pub unsafe fn placeholder(&self) -> Option<Retained<NSString>>;
325
326 #[unsafe(method(setPlaceholder:))]
328 #[unsafe(method_family = none)]
329 pub unsafe fn setPlaceholder(&self, placeholder: Option<&NSString>);
330
331 #[unsafe(method(attributedPlaceholder))]
332 #[unsafe(method_family = none)]
333 pub unsafe fn attributedPlaceholder(&self) -> Option<Retained<NSAttributedString>>;
334
335 #[unsafe(method(setAttributedPlaceholder:))]
337 #[unsafe(method_family = none)]
338 pub unsafe fn setAttributedPlaceholder(
339 &self,
340 attributed_placeholder: Option<&NSAttributedString>,
341 );
342
343 #[unsafe(method(clearsOnBeginEditing))]
344 #[unsafe(method_family = none)]
345 pub unsafe fn clearsOnBeginEditing(&self) -> bool;
346
347 #[unsafe(method(setClearsOnBeginEditing:))]
349 #[unsafe(method_family = none)]
350 pub unsafe fn setClearsOnBeginEditing(&self, clears_on_begin_editing: bool);
351
352 #[unsafe(method(adjustsFontSizeToFitWidth))]
353 #[unsafe(method_family = none)]
354 pub unsafe fn adjustsFontSizeToFitWidth(&self) -> bool;
355
356 #[unsafe(method(setAdjustsFontSizeToFitWidth:))]
358 #[unsafe(method_family = none)]
359 pub unsafe fn setAdjustsFontSizeToFitWidth(&self, adjusts_font_size_to_fit_width: bool);
360
361 #[cfg(feature = "objc2-core-foundation")]
362 #[unsafe(method(minimumFontSize))]
363 #[unsafe(method_family = none)]
364 pub unsafe fn minimumFontSize(&self) -> CGFloat;
365
366 #[cfg(feature = "objc2-core-foundation")]
367 #[unsafe(method(setMinimumFontSize:))]
369 #[unsafe(method_family = none)]
370 pub unsafe fn setMinimumFontSize(&self, minimum_font_size: CGFloat);
371
372 #[unsafe(method(delegate))]
373 #[unsafe(method_family = none)]
374 pub unsafe fn delegate(&self) -> Option<Retained<ProtocolObject<dyn UITextFieldDelegate>>>;
375
376 #[unsafe(method(setDelegate:))]
379 #[unsafe(method_family = none)]
380 pub unsafe fn setDelegate(
381 &self,
382 delegate: Option<&ProtocolObject<dyn UITextFieldDelegate>>,
383 );
384
385 #[cfg(feature = "UIImage")]
386 #[unsafe(method(background))]
387 #[unsafe(method_family = none)]
388 pub unsafe fn background(&self) -> Option<Retained<UIImage>>;
389
390 #[cfg(feature = "UIImage")]
391 #[unsafe(method(setBackground:))]
393 #[unsafe(method_family = none)]
394 pub unsafe fn setBackground(&self, background: Option<&UIImage>);
395
396 #[cfg(feature = "UIImage")]
397 #[unsafe(method(disabledBackground))]
398 #[unsafe(method_family = none)]
399 pub unsafe fn disabledBackground(&self) -> Option<Retained<UIImage>>;
400
401 #[cfg(feature = "UIImage")]
402 #[unsafe(method(setDisabledBackground:))]
404 #[unsafe(method_family = none)]
405 pub unsafe fn setDisabledBackground(&self, disabled_background: Option<&UIImage>);
406
407 #[unsafe(method(isEditing))]
408 #[unsafe(method_family = none)]
409 pub unsafe fn isEditing(&self) -> bool;
410
411 #[unsafe(method(allowsEditingTextAttributes))]
412 #[unsafe(method_family = none)]
413 pub unsafe fn allowsEditingTextAttributes(&self) -> bool;
414
415 #[unsafe(method(setAllowsEditingTextAttributes:))]
417 #[unsafe(method_family = none)]
418 pub unsafe fn setAllowsEditingTextAttributes(&self, allows_editing_text_attributes: bool);
419
420 #[unsafe(method(typingAttributes))]
421 #[unsafe(method_family = none)]
422 pub unsafe fn typingAttributes(
423 &self,
424 ) -> Option<Retained<NSDictionary<NSAttributedStringKey, AnyObject>>>;
425
426 #[unsafe(method(setTypingAttributes:))]
428 #[unsafe(method_family = none)]
429 pub unsafe fn setTypingAttributes(
430 &self,
431 typing_attributes: Option<&NSDictionary<NSAttributedStringKey, AnyObject>>,
432 );
433
434 #[unsafe(method(clearButtonMode))]
435 #[unsafe(method_family = none)]
436 pub unsafe fn clearButtonMode(&self) -> UITextFieldViewMode;
437
438 #[unsafe(method(setClearButtonMode:))]
440 #[unsafe(method_family = none)]
441 pub unsafe fn setClearButtonMode(&self, clear_button_mode: UITextFieldViewMode);
442
443 #[unsafe(method(leftView))]
444 #[unsafe(method_family = none)]
445 pub unsafe fn leftView(&self) -> Option<Retained<UIView>>;
446
447 #[unsafe(method(setLeftView:))]
449 #[unsafe(method_family = none)]
450 pub unsafe fn setLeftView(&self, left_view: Option<&UIView>);
451
452 #[unsafe(method(leftViewMode))]
453 #[unsafe(method_family = none)]
454 pub unsafe fn leftViewMode(&self) -> UITextFieldViewMode;
455
456 #[unsafe(method(setLeftViewMode:))]
458 #[unsafe(method_family = none)]
459 pub unsafe fn setLeftViewMode(&self, left_view_mode: UITextFieldViewMode);
460
461 #[unsafe(method(rightView))]
462 #[unsafe(method_family = none)]
463 pub unsafe fn rightView(&self) -> Option<Retained<UIView>>;
464
465 #[unsafe(method(setRightView:))]
467 #[unsafe(method_family = none)]
468 pub unsafe fn setRightView(&self, right_view: Option<&UIView>);
469
470 #[unsafe(method(rightViewMode))]
471 #[unsafe(method_family = none)]
472 pub unsafe fn rightViewMode(&self) -> UITextFieldViewMode;
473
474 #[unsafe(method(setRightViewMode:))]
476 #[unsafe(method_family = none)]
477 pub unsafe fn setRightViewMode(&self, right_view_mode: UITextFieldViewMode);
478
479 #[cfg(feature = "objc2-core-foundation")]
480 #[unsafe(method(borderRectForBounds:))]
481 #[unsafe(method_family = none)]
482 pub unsafe fn borderRectForBounds(&self, bounds: CGRect) -> CGRect;
483
484 #[cfg(feature = "objc2-core-foundation")]
485 #[unsafe(method(textRectForBounds:))]
486 #[unsafe(method_family = none)]
487 pub unsafe fn textRectForBounds(&self, bounds: CGRect) -> CGRect;
488
489 #[cfg(feature = "objc2-core-foundation")]
490 #[unsafe(method(placeholderRectForBounds:))]
491 #[unsafe(method_family = none)]
492 pub unsafe fn placeholderRectForBounds(&self, bounds: CGRect) -> CGRect;
493
494 #[cfg(feature = "objc2-core-foundation")]
495 #[unsafe(method(editingRectForBounds:))]
496 #[unsafe(method_family = none)]
497 pub unsafe fn editingRectForBounds(&self, bounds: CGRect) -> CGRect;
498
499 #[cfg(feature = "objc2-core-foundation")]
500 #[unsafe(method(clearButtonRectForBounds:))]
501 #[unsafe(method_family = none)]
502 pub unsafe fn clearButtonRectForBounds(&self, bounds: CGRect) -> CGRect;
503
504 #[cfg(feature = "objc2-core-foundation")]
505 #[unsafe(method(leftViewRectForBounds:))]
506 #[unsafe(method_family = none)]
507 pub unsafe fn leftViewRectForBounds(&self, bounds: CGRect) -> CGRect;
508
509 #[cfg(feature = "objc2-core-foundation")]
510 #[unsafe(method(rightViewRectForBounds:))]
511 #[unsafe(method_family = none)]
512 pub unsafe fn rightViewRectForBounds(&self, bounds: CGRect) -> CGRect;
513
514 #[cfg(feature = "objc2-core-foundation")]
515 #[deprecated = "This method is no longer called."]
516 #[unsafe(method(drawTextInRect:))]
517 #[unsafe(method_family = none)]
518 pub unsafe fn drawTextInRect(&self, rect: CGRect);
519
520 #[cfg(feature = "objc2-core-foundation")]
521 #[unsafe(method(drawPlaceholderInRect:))]
522 #[unsafe(method_family = none)]
523 pub unsafe fn drawPlaceholderInRect(&self, rect: CGRect);
524
525 #[unsafe(method(inputView))]
526 #[unsafe(method_family = none)]
527 pub unsafe fn inputView(&self) -> Option<Retained<UIView>>;
528
529 #[unsafe(method(setInputView:))]
531 #[unsafe(method_family = none)]
532 pub unsafe fn setInputView(&self, input_view: Option<&UIView>);
533
534 #[unsafe(method(inputAccessoryView))]
535 #[unsafe(method_family = none)]
536 pub unsafe fn inputAccessoryView(&self) -> Option<Retained<UIView>>;
537
538 #[unsafe(method(setInputAccessoryView:))]
540 #[unsafe(method_family = none)]
541 pub unsafe fn setInputAccessoryView(&self, input_accessory_view: Option<&UIView>);
542
543 #[unsafe(method(clearsOnInsertion))]
544 #[unsafe(method_family = none)]
545 pub unsafe fn clearsOnInsertion(&self) -> bool;
546
547 #[unsafe(method(setClearsOnInsertion:))]
549 #[unsafe(method_family = none)]
550 pub unsafe fn setClearsOnInsertion(&self, clears_on_insertion: bool);
551 );
552}
553
554#[cfg(all(feature = "UIControl", feature = "UIResponder", feature = "UIView"))]
556impl UITextField {
557 extern_methods!(
558 #[cfg(feature = "objc2-core-foundation")]
559 #[unsafe(method(initWithFrame:))]
560 #[unsafe(method_family = init)]
561 pub unsafe fn initWithFrame(this: Allocated<Self>, frame: CGRect) -> Retained<Self>;
562
563 #[unsafe(method(initWithCoder:))]
564 #[unsafe(method_family = init)]
565 pub unsafe fn initWithCoder(
566 this: Allocated<Self>,
567 coder: &NSCoder,
568 ) -> Option<Retained<Self>>;
569
570 #[cfg(all(
571 feature = "UIAction",
572 feature = "UIMenuElement",
573 feature = "objc2-core-foundation"
574 ))]
575 #[unsafe(method(initWithFrame:primaryAction:))]
577 #[unsafe(method_family = init)]
578 pub unsafe fn initWithFrame_primaryAction(
579 this: Allocated<Self>,
580 frame: CGRect,
581 primary_action: Option<&UIAction>,
582 ) -> Retained<Self>;
583 );
584}
585
586#[cfg(all(feature = "UIControl", feature = "UIResponder", feature = "UIView"))]
588impl UITextField {
589 extern_methods!(
590 #[unsafe(method(init))]
591 #[unsafe(method_family = init)]
592 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
593
594 #[unsafe(method(new))]
595 #[unsafe(method_family = new)]
596 pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
597 );
598}
599
600#[cfg(all(feature = "UIControl", feature = "UIResponder", feature = "UIView"))]
601impl UITextField {
602 extern_methods!();
603}
604
605#[cfg(all(
606 feature = "UIControl",
607 feature = "UIResponder",
608 feature = "UITextDragging",
609 feature = "UITextInput",
610 feature = "UITextInputTraits",
611 feature = "UIView"
612))]
613extern_conformance!(
614 unsafe impl UITextDraggable for UITextField {}
615);
616
617#[cfg(all(
618 feature = "UIControl",
619 feature = "UIPasteConfigurationSupporting",
620 feature = "UIResponder",
621 feature = "UITextDropping",
622 feature = "UITextInput",
623 feature = "UITextInputTraits",
624 feature = "UITextPasteConfigurationSupporting",
625 feature = "UIView"
626))]
627extern_conformance!(
628 unsafe impl UITextDroppable for UITextField {}
629);
630
631#[cfg(all(
632 feature = "UIControl",
633 feature = "UIPasteConfigurationSupporting",
634 feature = "UIResponder",
635 feature = "UITextPasteConfigurationSupporting",
636 feature = "UIView"
637))]
638extern_conformance!(
639 unsafe impl UITextPasteConfigurationSupporting for UITextField {}
640);
641
642#[cfg(all(feature = "UIControl", feature = "UIResponder", feature = "UIView"))]
644impl UITextField {
645 extern_methods!(
646 #[unsafe(method(interactionState))]
647 #[unsafe(method_family = none)]
648 pub unsafe fn interactionState(&self) -> Retained<AnyObject>;
649
650 #[unsafe(method(setInteractionState:))]
652 #[unsafe(method_family = none)]
653 pub unsafe fn setInteractionState(&self, interaction_state: &AnyObject);
654 );
655}
656
657#[cfg(all(feature = "UIResponder", feature = "UIView"))]
659impl UIView {
660 extern_methods!(
661 #[unsafe(method(endEditing:))]
662 #[unsafe(method_family = none)]
663 pub unsafe fn endEditing(&self, force: bool) -> bool;
664 );
665}
666
667extern_protocol!(
668 pub unsafe trait UITextFieldDelegate: NSObjectProtocol + MainThreadOnly {
670 #[cfg(all(feature = "UIControl", feature = "UIResponder", feature = "UIView"))]
671 #[optional]
672 #[unsafe(method(textFieldShouldBeginEditing:))]
673 #[unsafe(method_family = none)]
674 unsafe fn textFieldShouldBeginEditing(&self, text_field: &UITextField) -> bool;
675
676 #[cfg(all(feature = "UIControl", feature = "UIResponder", feature = "UIView"))]
677 #[optional]
678 #[unsafe(method(textFieldDidBeginEditing:))]
679 #[unsafe(method_family = none)]
680 unsafe fn textFieldDidBeginEditing(&self, text_field: &UITextField);
681
682 #[cfg(all(feature = "UIControl", feature = "UIResponder", feature = "UIView"))]
683 #[optional]
684 #[unsafe(method(textFieldShouldEndEditing:))]
685 #[unsafe(method_family = none)]
686 unsafe fn textFieldShouldEndEditing(&self, text_field: &UITextField) -> bool;
687
688 #[cfg(all(feature = "UIControl", feature = "UIResponder", feature = "UIView"))]
689 #[optional]
690 #[unsafe(method(textFieldDidEndEditing:))]
691 #[unsafe(method_family = none)]
692 unsafe fn textFieldDidEndEditing(&self, text_field: &UITextField);
693
694 #[cfg(all(feature = "UIControl", feature = "UIResponder", feature = "UIView"))]
695 #[optional]
696 #[unsafe(method(textFieldDidEndEditing:reason:))]
697 #[unsafe(method_family = none)]
698 unsafe fn textFieldDidEndEditing_reason(
699 &self,
700 text_field: &UITextField,
701 reason: UITextFieldDidEndEditingReason,
702 );
703
704 #[cfg(all(feature = "UIControl", feature = "UIResponder", feature = "UIView"))]
705 #[optional]
706 #[unsafe(method(textField:shouldChangeCharactersInRange:replacementString:))]
707 #[unsafe(method_family = none)]
708 unsafe fn textField_shouldChangeCharactersInRange_replacementString(
709 &self,
710 text_field: &UITextField,
711 range: NSRange,
712 string: &NSString,
713 ) -> bool;
714
715 #[cfg(all(feature = "UIControl", feature = "UIResponder", feature = "UIView"))]
716 #[optional]
717 #[unsafe(method(textFieldDidChangeSelection:))]
718 #[unsafe(method_family = none)]
719 unsafe fn textFieldDidChangeSelection(&self, text_field: &UITextField);
720
721 #[cfg(all(feature = "UIControl", feature = "UIResponder", feature = "UIView"))]
722 #[optional]
723 #[unsafe(method(textFieldShouldClear:))]
724 #[unsafe(method_family = none)]
725 unsafe fn textFieldShouldClear(&self, text_field: &UITextField) -> bool;
726
727 #[cfg(all(feature = "UIControl", feature = "UIResponder", feature = "UIView"))]
728 #[optional]
729 #[unsafe(method(textFieldShouldReturn:))]
730 #[unsafe(method_family = none)]
731 unsafe fn textFieldShouldReturn(&self, text_field: &UITextField) -> bool;
732
733 #[cfg(all(
734 feature = "UIControl",
735 feature = "UIMenu",
736 feature = "UIMenuElement",
737 feature = "UIResponder",
738 feature = "UIView"
739 ))]
740 #[optional]
753 #[unsafe(method(textField:editMenuForCharactersInRange:suggestedActions:))]
754 #[unsafe(method_family = none)]
755 unsafe fn textField_editMenuForCharactersInRange_suggestedActions(
756 &self,
757 text_field: &UITextField,
758 range: NSRange,
759 suggested_actions: &NSArray<UIMenuElement>,
760 ) -> Option<Retained<UIMenu>>;
761
762 #[cfg(all(
763 feature = "UIControl",
764 feature = "UIEditMenuInteraction",
765 feature = "UIResponder",
766 feature = "UIView"
767 ))]
768 #[optional]
775 #[unsafe(method(textField:willPresentEditMenuWithAnimator:))]
776 #[unsafe(method_family = none)]
777 unsafe fn textField_willPresentEditMenuWithAnimator(
778 &self,
779 text_field: &UITextField,
780 animator: &ProtocolObject<dyn UIEditMenuInteractionAnimating>,
781 );
782
783 #[cfg(all(
784 feature = "UIControl",
785 feature = "UIEditMenuInteraction",
786 feature = "UIResponder",
787 feature = "UIView"
788 ))]
789 #[optional]
796 #[unsafe(method(textField:willDismissEditMenuWithAnimator:))]
797 #[unsafe(method_family = none)]
798 unsafe fn textField_willDismissEditMenuWithAnimator(
799 &self,
800 text_field: &UITextField,
801 animator: &ProtocolObject<dyn UIEditMenuInteractionAnimating>,
802 );
803
804 #[cfg(all(
805 feature = "UIControl",
806 feature = "UIInputSuggestion",
807 feature = "UIResponder",
808 feature = "UIView"
809 ))]
810 #[optional]
816 #[unsafe(method(textField:insertInputSuggestion:))]
817 #[unsafe(method_family = none)]
818 unsafe fn textField_insertInputSuggestion(
819 &self,
820 text_field: &UITextField,
821 input_suggestion: &UIInputSuggestion,
822 );
823 }
824);
825
826extern "C" {
827 pub static UITextFieldTextDidBeginEditingNotification: &'static NSNotificationName;
829}
830
831extern "C" {
832 pub static UITextFieldTextDidEndEditingNotification: &'static NSNotificationName;
834}
835
836extern "C" {
837 pub static UITextFieldTextDidChangeNotification: &'static NSNotificationName;
839}
840
841extern "C" {
842 pub static UITextFieldDidEndEditingReasonKey: &'static NSString;
844}