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"))]
99unsafe impl CALayerDelegate for UITextField {}
100
101#[cfg(all(feature = "UIControl", feature = "UIResponder", feature = "UIView"))]
102unsafe impl NSCoding for UITextField {}
103
104#[cfg(all(feature = "UIControl", feature = "UIResponder", feature = "UIView"))]
105unsafe impl NSObjectProtocol for UITextField {}
106
107#[cfg(all(
108 feature = "UIAppearance",
109 feature = "UIControl",
110 feature = "UIResponder",
111 feature = "UIView"
112))]
113unsafe impl UIAppearance for UITextField {}
114
115#[cfg(all(
116 feature = "UIAppearance",
117 feature = "UIControl",
118 feature = "UIResponder",
119 feature = "UIView"
120))]
121unsafe impl UIAppearanceContainer for UITextField {}
122
123#[cfg(all(
124 feature = "UIContentSizeCategoryAdjusting",
125 feature = "UIControl",
126 feature = "UIResponder",
127 feature = "UIView"
128))]
129unsafe impl UIContentSizeCategoryAdjusting for UITextField {}
130
131#[cfg(all(feature = "UIControl", feature = "UIResponder", feature = "UIView"))]
132unsafe impl UICoordinateSpace for UITextField {}
133
134#[cfg(all(
135 feature = "UIControl",
136 feature = "UIDynamicBehavior",
137 feature = "UIResponder",
138 feature = "UIView"
139))]
140unsafe impl UIDynamicItem for UITextField {}
141
142#[cfg(all(
143 feature = "UIControl",
144 feature = "UIFocus",
145 feature = "UIResponder",
146 feature = "UIView"
147))]
148unsafe impl UIFocusEnvironment for UITextField {}
149
150#[cfg(all(
151 feature = "UIControl",
152 feature = "UIFocus",
153 feature = "UIResponder",
154 feature = "UIView"
155))]
156unsafe impl UIFocusItem for UITextField {}
157
158#[cfg(all(
159 feature = "UIControl",
160 feature = "UIFocus",
161 feature = "UIResponder",
162 feature = "UIView"
163))]
164unsafe impl UIFocusItemContainer for UITextField {}
165
166#[cfg(all(
167 feature = "UIControl",
168 feature = "UIResponder",
169 feature = "UITextInput",
170 feature = "UITextInputTraits",
171 feature = "UIView"
172))]
173unsafe impl UIKeyInput for UITextField {}
174
175#[cfg(all(
176 feature = "UIControl",
177 feature = "UILetterformAwareAdjusting",
178 feature = "UIResponder",
179 feature = "UIView"
180))]
181unsafe impl UILetterformAwareAdjusting for UITextField {}
182
183#[cfg(all(feature = "UIControl", feature = "UIResponder", feature = "UIView"))]
184unsafe impl UIResponderStandardEditActions for UITextField {}
185
186#[cfg(all(
187 feature = "UIControl",
188 feature = "UIResponder",
189 feature = "UITextInput",
190 feature = "UITextInputTraits",
191 feature = "UIView"
192))]
193unsafe impl UITextInput for UITextField {}
194
195#[cfg(all(
196 feature = "UIControl",
197 feature = "UIResponder",
198 feature = "UITextInputTraits",
199 feature = "UIView"
200))]
201unsafe impl UITextInputTraits for UITextField {}
202
203#[cfg(all(
204 feature = "UIControl",
205 feature = "UIResponder",
206 feature = "UITraitCollection",
207 feature = "UIView"
208))]
209unsafe impl UITraitEnvironment for UITextField {}
210
211#[cfg(all(feature = "UIControl", feature = "UIResponder", feature = "UIView"))]
212impl UITextField {
213 extern_methods!(
214 #[unsafe(method(text))]
215 #[unsafe(method_family = none)]
216 pub unsafe fn text(&self) -> Option<Retained<NSString>>;
217
218 #[unsafe(method(setText:))]
220 #[unsafe(method_family = none)]
221 pub unsafe fn setText(&self, text: Option<&NSString>);
222
223 #[unsafe(method(attributedText))]
224 #[unsafe(method_family = none)]
225 pub unsafe fn attributedText(&self) -> Option<Retained<NSAttributedString>>;
226
227 #[unsafe(method(setAttributedText:))]
229 #[unsafe(method_family = none)]
230 pub unsafe fn setAttributedText(&self, attributed_text: Option<&NSAttributedString>);
231
232 #[cfg(feature = "UIColor")]
233 #[unsafe(method(textColor))]
234 #[unsafe(method_family = none)]
235 pub unsafe fn textColor(&self) -> Option<Retained<UIColor>>;
236
237 #[cfg(feature = "UIColor")]
238 #[unsafe(method(setTextColor:))]
240 #[unsafe(method_family = none)]
241 pub unsafe fn setTextColor(&self, text_color: Option<&UIColor>);
242
243 #[cfg(feature = "UIFont")]
244 #[unsafe(method(font))]
245 #[unsafe(method_family = none)]
246 pub unsafe fn font(&self) -> Option<Retained<UIFont>>;
247
248 #[cfg(feature = "UIFont")]
249 #[unsafe(method(setFont:))]
251 #[unsafe(method_family = none)]
252 pub unsafe fn setFont(&self, font: Option<&UIFont>);
253
254 #[cfg(feature = "NSText")]
255 #[unsafe(method(textAlignment))]
256 #[unsafe(method_family = none)]
257 pub unsafe fn textAlignment(&self) -> NSTextAlignment;
258
259 #[cfg(feature = "NSText")]
260 #[unsafe(method(setTextAlignment:))]
262 #[unsafe(method_family = none)]
263 pub unsafe fn setTextAlignment(&self, text_alignment: NSTextAlignment);
264
265 #[unsafe(method(borderStyle))]
266 #[unsafe(method_family = none)]
267 pub unsafe fn borderStyle(&self) -> UITextBorderStyle;
268
269 #[unsafe(method(setBorderStyle:))]
271 #[unsafe(method_family = none)]
272 pub unsafe fn setBorderStyle(&self, border_style: UITextBorderStyle);
273
274 #[unsafe(method(defaultTextAttributes))]
275 #[unsafe(method_family = none)]
276 pub unsafe fn defaultTextAttributes(
277 &self,
278 ) -> Retained<NSDictionary<NSAttributedStringKey, AnyObject>>;
279
280 #[unsafe(method(setDefaultTextAttributes:))]
282 #[unsafe(method_family = none)]
283 pub unsafe fn setDefaultTextAttributes(
284 &self,
285 default_text_attributes: &NSDictionary<NSAttributedStringKey, AnyObject>,
286 );
287
288 #[unsafe(method(placeholder))]
289 #[unsafe(method_family = none)]
290 pub unsafe fn placeholder(&self) -> Option<Retained<NSString>>;
291
292 #[unsafe(method(setPlaceholder:))]
294 #[unsafe(method_family = none)]
295 pub unsafe fn setPlaceholder(&self, placeholder: Option<&NSString>);
296
297 #[unsafe(method(attributedPlaceholder))]
298 #[unsafe(method_family = none)]
299 pub unsafe fn attributedPlaceholder(&self) -> Option<Retained<NSAttributedString>>;
300
301 #[unsafe(method(setAttributedPlaceholder:))]
303 #[unsafe(method_family = none)]
304 pub unsafe fn setAttributedPlaceholder(
305 &self,
306 attributed_placeholder: Option<&NSAttributedString>,
307 );
308
309 #[unsafe(method(clearsOnBeginEditing))]
310 #[unsafe(method_family = none)]
311 pub unsafe fn clearsOnBeginEditing(&self) -> bool;
312
313 #[unsafe(method(setClearsOnBeginEditing:))]
315 #[unsafe(method_family = none)]
316 pub unsafe fn setClearsOnBeginEditing(&self, clears_on_begin_editing: bool);
317
318 #[unsafe(method(adjustsFontSizeToFitWidth))]
319 #[unsafe(method_family = none)]
320 pub unsafe fn adjustsFontSizeToFitWidth(&self) -> bool;
321
322 #[unsafe(method(setAdjustsFontSizeToFitWidth:))]
324 #[unsafe(method_family = none)]
325 pub unsafe fn setAdjustsFontSizeToFitWidth(&self, adjusts_font_size_to_fit_width: bool);
326
327 #[cfg(feature = "objc2-core-foundation")]
328 #[unsafe(method(minimumFontSize))]
329 #[unsafe(method_family = none)]
330 pub unsafe fn minimumFontSize(&self) -> CGFloat;
331
332 #[cfg(feature = "objc2-core-foundation")]
333 #[unsafe(method(setMinimumFontSize:))]
335 #[unsafe(method_family = none)]
336 pub unsafe fn setMinimumFontSize(&self, minimum_font_size: CGFloat);
337
338 #[unsafe(method(delegate))]
339 #[unsafe(method_family = none)]
340 pub unsafe fn delegate(&self) -> Option<Retained<ProtocolObject<dyn UITextFieldDelegate>>>;
341
342 #[unsafe(method(setDelegate:))]
345 #[unsafe(method_family = none)]
346 pub unsafe fn setDelegate(
347 &self,
348 delegate: Option<&ProtocolObject<dyn UITextFieldDelegate>>,
349 );
350
351 #[cfg(feature = "UIImage")]
352 #[unsafe(method(background))]
353 #[unsafe(method_family = none)]
354 pub unsafe fn background(&self) -> Option<Retained<UIImage>>;
355
356 #[cfg(feature = "UIImage")]
357 #[unsafe(method(setBackground:))]
359 #[unsafe(method_family = none)]
360 pub unsafe fn setBackground(&self, background: Option<&UIImage>);
361
362 #[cfg(feature = "UIImage")]
363 #[unsafe(method(disabledBackground))]
364 #[unsafe(method_family = none)]
365 pub unsafe fn disabledBackground(&self) -> Option<Retained<UIImage>>;
366
367 #[cfg(feature = "UIImage")]
368 #[unsafe(method(setDisabledBackground:))]
370 #[unsafe(method_family = none)]
371 pub unsafe fn setDisabledBackground(&self, disabled_background: Option<&UIImage>);
372
373 #[unsafe(method(isEditing))]
374 #[unsafe(method_family = none)]
375 pub unsafe fn isEditing(&self) -> bool;
376
377 #[unsafe(method(allowsEditingTextAttributes))]
378 #[unsafe(method_family = none)]
379 pub unsafe fn allowsEditingTextAttributes(&self) -> bool;
380
381 #[unsafe(method(setAllowsEditingTextAttributes:))]
383 #[unsafe(method_family = none)]
384 pub unsafe fn setAllowsEditingTextAttributes(&self, allows_editing_text_attributes: bool);
385
386 #[unsafe(method(typingAttributes))]
387 #[unsafe(method_family = none)]
388 pub unsafe fn typingAttributes(
389 &self,
390 ) -> Option<Retained<NSDictionary<NSAttributedStringKey, AnyObject>>>;
391
392 #[unsafe(method(setTypingAttributes:))]
394 #[unsafe(method_family = none)]
395 pub unsafe fn setTypingAttributes(
396 &self,
397 typing_attributes: Option<&NSDictionary<NSAttributedStringKey, AnyObject>>,
398 );
399
400 #[unsafe(method(clearButtonMode))]
401 #[unsafe(method_family = none)]
402 pub unsafe fn clearButtonMode(&self) -> UITextFieldViewMode;
403
404 #[unsafe(method(setClearButtonMode:))]
406 #[unsafe(method_family = none)]
407 pub unsafe fn setClearButtonMode(&self, clear_button_mode: UITextFieldViewMode);
408
409 #[unsafe(method(leftView))]
410 #[unsafe(method_family = none)]
411 pub unsafe fn leftView(&self) -> Option<Retained<UIView>>;
412
413 #[unsafe(method(setLeftView:))]
415 #[unsafe(method_family = none)]
416 pub unsafe fn setLeftView(&self, left_view: Option<&UIView>);
417
418 #[unsafe(method(leftViewMode))]
419 #[unsafe(method_family = none)]
420 pub unsafe fn leftViewMode(&self) -> UITextFieldViewMode;
421
422 #[unsafe(method(setLeftViewMode:))]
424 #[unsafe(method_family = none)]
425 pub unsafe fn setLeftViewMode(&self, left_view_mode: UITextFieldViewMode);
426
427 #[unsafe(method(rightView))]
428 #[unsafe(method_family = none)]
429 pub unsafe fn rightView(&self) -> Option<Retained<UIView>>;
430
431 #[unsafe(method(setRightView:))]
433 #[unsafe(method_family = none)]
434 pub unsafe fn setRightView(&self, right_view: Option<&UIView>);
435
436 #[unsafe(method(rightViewMode))]
437 #[unsafe(method_family = none)]
438 pub unsafe fn rightViewMode(&self) -> UITextFieldViewMode;
439
440 #[unsafe(method(setRightViewMode:))]
442 #[unsafe(method_family = none)]
443 pub unsafe fn setRightViewMode(&self, right_view_mode: UITextFieldViewMode);
444
445 #[cfg(feature = "objc2-core-foundation")]
446 #[unsafe(method(borderRectForBounds:))]
447 #[unsafe(method_family = none)]
448 pub unsafe fn borderRectForBounds(&self, bounds: CGRect) -> CGRect;
449
450 #[cfg(feature = "objc2-core-foundation")]
451 #[unsafe(method(textRectForBounds:))]
452 #[unsafe(method_family = none)]
453 pub unsafe fn textRectForBounds(&self, bounds: CGRect) -> CGRect;
454
455 #[cfg(feature = "objc2-core-foundation")]
456 #[unsafe(method(placeholderRectForBounds:))]
457 #[unsafe(method_family = none)]
458 pub unsafe fn placeholderRectForBounds(&self, bounds: CGRect) -> CGRect;
459
460 #[cfg(feature = "objc2-core-foundation")]
461 #[unsafe(method(editingRectForBounds:))]
462 #[unsafe(method_family = none)]
463 pub unsafe fn editingRectForBounds(&self, bounds: CGRect) -> CGRect;
464
465 #[cfg(feature = "objc2-core-foundation")]
466 #[unsafe(method(clearButtonRectForBounds:))]
467 #[unsafe(method_family = none)]
468 pub unsafe fn clearButtonRectForBounds(&self, bounds: CGRect) -> CGRect;
469
470 #[cfg(feature = "objc2-core-foundation")]
471 #[unsafe(method(leftViewRectForBounds:))]
472 #[unsafe(method_family = none)]
473 pub unsafe fn leftViewRectForBounds(&self, bounds: CGRect) -> CGRect;
474
475 #[cfg(feature = "objc2-core-foundation")]
476 #[unsafe(method(rightViewRectForBounds:))]
477 #[unsafe(method_family = none)]
478 pub unsafe fn rightViewRectForBounds(&self, bounds: CGRect) -> CGRect;
479
480 #[cfg(feature = "objc2-core-foundation")]
481 #[deprecated = "This method is no longer called."]
482 #[unsafe(method(drawTextInRect:))]
483 #[unsafe(method_family = none)]
484 pub unsafe fn drawTextInRect(&self, rect: CGRect);
485
486 #[cfg(feature = "objc2-core-foundation")]
487 #[unsafe(method(drawPlaceholderInRect:))]
488 #[unsafe(method_family = none)]
489 pub unsafe fn drawPlaceholderInRect(&self, rect: CGRect);
490
491 #[unsafe(method(inputView))]
492 #[unsafe(method_family = none)]
493 pub unsafe fn inputView(&self) -> Option<Retained<UIView>>;
494
495 #[unsafe(method(setInputView:))]
497 #[unsafe(method_family = none)]
498 pub unsafe fn setInputView(&self, input_view: Option<&UIView>);
499
500 #[unsafe(method(inputAccessoryView))]
501 #[unsafe(method_family = none)]
502 pub unsafe fn inputAccessoryView(&self) -> Option<Retained<UIView>>;
503
504 #[unsafe(method(setInputAccessoryView:))]
506 #[unsafe(method_family = none)]
507 pub unsafe fn setInputAccessoryView(&self, input_accessory_view: Option<&UIView>);
508
509 #[unsafe(method(clearsOnInsertion))]
510 #[unsafe(method_family = none)]
511 pub unsafe fn clearsOnInsertion(&self) -> bool;
512
513 #[unsafe(method(setClearsOnInsertion:))]
515 #[unsafe(method_family = none)]
516 pub unsafe fn setClearsOnInsertion(&self, clears_on_insertion: bool);
517 );
518}
519
520#[cfg(all(feature = "UIControl", feature = "UIResponder", feature = "UIView"))]
522impl UITextField {
523 extern_methods!(
524 #[cfg(feature = "objc2-core-foundation")]
525 #[unsafe(method(initWithFrame:))]
526 #[unsafe(method_family = init)]
527 pub unsafe fn initWithFrame(this: Allocated<Self>, frame: CGRect) -> Retained<Self>;
528
529 #[unsafe(method(initWithCoder:))]
530 #[unsafe(method_family = init)]
531 pub unsafe fn initWithCoder(
532 this: Allocated<Self>,
533 coder: &NSCoder,
534 ) -> Option<Retained<Self>>;
535
536 #[cfg(all(
537 feature = "UIAction",
538 feature = "UIMenuElement",
539 feature = "objc2-core-foundation"
540 ))]
541 #[unsafe(method(initWithFrame:primaryAction:))]
543 #[unsafe(method_family = init)]
544 pub unsafe fn initWithFrame_primaryAction(
545 this: Allocated<Self>,
546 frame: CGRect,
547 primary_action: Option<&UIAction>,
548 ) -> Retained<Self>;
549 );
550}
551
552#[cfg(all(feature = "UIControl", feature = "UIResponder", feature = "UIView"))]
554impl UITextField {
555 extern_methods!(
556 #[unsafe(method(init))]
557 #[unsafe(method_family = init)]
558 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
559
560 #[unsafe(method(new))]
561 #[unsafe(method_family = new)]
562 pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
563 );
564}
565
566#[cfg(all(feature = "UIControl", feature = "UIResponder", feature = "UIView"))]
567impl UITextField {
568 extern_methods!();
569}
570
571#[cfg(all(
572 feature = "UIControl",
573 feature = "UIResponder",
574 feature = "UITextDragging",
575 feature = "UITextInput",
576 feature = "UITextInputTraits",
577 feature = "UIView"
578))]
579unsafe impl UITextDraggable for UITextField {}
580
581#[cfg(all(
582 feature = "UIControl",
583 feature = "UIPasteConfigurationSupporting",
584 feature = "UIResponder",
585 feature = "UITextDropping",
586 feature = "UITextInput",
587 feature = "UITextInputTraits",
588 feature = "UITextPasteConfigurationSupporting",
589 feature = "UIView"
590))]
591unsafe impl UITextDroppable for UITextField {}
592
593#[cfg(all(
594 feature = "UIControl",
595 feature = "UIPasteConfigurationSupporting",
596 feature = "UIResponder",
597 feature = "UITextPasteConfigurationSupporting",
598 feature = "UIView"
599))]
600unsafe impl UITextPasteConfigurationSupporting for UITextField {}
601
602#[cfg(all(feature = "UIControl", feature = "UIResponder", feature = "UIView"))]
604impl UITextField {
605 extern_methods!(
606 #[unsafe(method(interactionState))]
607 #[unsafe(method_family = none)]
608 pub unsafe fn interactionState(&self) -> Retained<AnyObject>;
609
610 #[unsafe(method(setInteractionState:))]
612 #[unsafe(method_family = none)]
613 pub unsafe fn setInteractionState(&self, interaction_state: &AnyObject);
614 );
615}
616
617#[cfg(all(feature = "UIResponder", feature = "UIView"))]
619impl UIView {
620 extern_methods!(
621 #[unsafe(method(endEditing:))]
622 #[unsafe(method_family = none)]
623 pub unsafe fn endEditing(&self, force: bool) -> bool;
624 );
625}
626
627extern_protocol!(
628 pub unsafe trait UITextFieldDelegate: NSObjectProtocol + MainThreadOnly {
630 #[cfg(all(feature = "UIControl", feature = "UIResponder", feature = "UIView"))]
631 #[optional]
632 #[unsafe(method(textFieldShouldBeginEditing:))]
633 #[unsafe(method_family = none)]
634 unsafe fn textFieldShouldBeginEditing(&self, text_field: &UITextField) -> bool;
635
636 #[cfg(all(feature = "UIControl", feature = "UIResponder", feature = "UIView"))]
637 #[optional]
638 #[unsafe(method(textFieldDidBeginEditing:))]
639 #[unsafe(method_family = none)]
640 unsafe fn textFieldDidBeginEditing(&self, text_field: &UITextField);
641
642 #[cfg(all(feature = "UIControl", feature = "UIResponder", feature = "UIView"))]
643 #[optional]
644 #[unsafe(method(textFieldShouldEndEditing:))]
645 #[unsafe(method_family = none)]
646 unsafe fn textFieldShouldEndEditing(&self, text_field: &UITextField) -> bool;
647
648 #[cfg(all(feature = "UIControl", feature = "UIResponder", feature = "UIView"))]
649 #[optional]
650 #[unsafe(method(textFieldDidEndEditing:))]
651 #[unsafe(method_family = none)]
652 unsafe fn textFieldDidEndEditing(&self, text_field: &UITextField);
653
654 #[cfg(all(feature = "UIControl", feature = "UIResponder", feature = "UIView"))]
655 #[optional]
656 #[unsafe(method(textFieldDidEndEditing:reason:))]
657 #[unsafe(method_family = none)]
658 unsafe fn textFieldDidEndEditing_reason(
659 &self,
660 text_field: &UITextField,
661 reason: UITextFieldDidEndEditingReason,
662 );
663
664 #[cfg(all(feature = "UIControl", feature = "UIResponder", feature = "UIView"))]
665 #[optional]
666 #[unsafe(method(textField:shouldChangeCharactersInRange:replacementString:))]
667 #[unsafe(method_family = none)]
668 unsafe fn textField_shouldChangeCharactersInRange_replacementString(
669 &self,
670 text_field: &UITextField,
671 range: NSRange,
672 string: &NSString,
673 ) -> bool;
674
675 #[cfg(all(feature = "UIControl", feature = "UIResponder", feature = "UIView"))]
676 #[optional]
677 #[unsafe(method(textFieldDidChangeSelection:))]
678 #[unsafe(method_family = none)]
679 unsafe fn textFieldDidChangeSelection(&self, text_field: &UITextField);
680
681 #[cfg(all(feature = "UIControl", feature = "UIResponder", feature = "UIView"))]
682 #[optional]
683 #[unsafe(method(textFieldShouldClear:))]
684 #[unsafe(method_family = none)]
685 unsafe fn textFieldShouldClear(&self, text_field: &UITextField) -> bool;
686
687 #[cfg(all(feature = "UIControl", feature = "UIResponder", feature = "UIView"))]
688 #[optional]
689 #[unsafe(method(textFieldShouldReturn:))]
690 #[unsafe(method_family = none)]
691 unsafe fn textFieldShouldReturn(&self, text_field: &UITextField) -> bool;
692
693 #[cfg(all(
694 feature = "UIControl",
695 feature = "UIMenu",
696 feature = "UIMenuElement",
697 feature = "UIResponder",
698 feature = "UIView"
699 ))]
700 #[optional]
713 #[unsafe(method(textField:editMenuForCharactersInRange:suggestedActions:))]
714 #[unsafe(method_family = none)]
715 unsafe fn textField_editMenuForCharactersInRange_suggestedActions(
716 &self,
717 text_field: &UITextField,
718 range: NSRange,
719 suggested_actions: &NSArray<UIMenuElement>,
720 ) -> Option<Retained<UIMenu>>;
721
722 #[cfg(all(
723 feature = "UIControl",
724 feature = "UIEditMenuInteraction",
725 feature = "UIResponder",
726 feature = "UIView"
727 ))]
728 #[optional]
735 #[unsafe(method(textField:willPresentEditMenuWithAnimator:))]
736 #[unsafe(method_family = none)]
737 unsafe fn textField_willPresentEditMenuWithAnimator(
738 &self,
739 text_field: &UITextField,
740 animator: &ProtocolObject<dyn UIEditMenuInteractionAnimating>,
741 );
742
743 #[cfg(all(
744 feature = "UIControl",
745 feature = "UIEditMenuInteraction",
746 feature = "UIResponder",
747 feature = "UIView"
748 ))]
749 #[optional]
756 #[unsafe(method(textField:willDismissEditMenuWithAnimator:))]
757 #[unsafe(method_family = none)]
758 unsafe fn textField_willDismissEditMenuWithAnimator(
759 &self,
760 text_field: &UITextField,
761 animator: &ProtocolObject<dyn UIEditMenuInteractionAnimating>,
762 );
763 }
764);
765
766extern "C" {
767 pub static UITextFieldTextDidBeginEditingNotification: &'static NSNotificationName;
769}
770
771extern "C" {
772 pub static UITextFieldTextDidEndEditingNotification: &'static NSNotificationName;
774}
775
776extern "C" {
777 pub static UITextFieldTextDidChangeNotification: &'static NSNotificationName;
779}
780
781extern "C" {
782 pub static UITextFieldDidEndEditingReasonKey: &'static NSString;
784}