1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use objc2::__framework_prelude::*;
use objc2_foundation::*;
#[cfg(feature = "objc2-quartz-core")]
#[cfg(not(target_os = "watchos"))]
use objc2_quartz_core::*;

use crate::*;

// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct UITextBorderStyle(pub NSInteger);
impl UITextBorderStyle {
    #[doc(alias = "UITextBorderStyleNone")]
    pub const None: Self = Self(0);
    #[doc(alias = "UITextBorderStyleLine")]
    pub const Line: Self = Self(1);
    #[doc(alias = "UITextBorderStyleBezel")]
    pub const Bezel: Self = Self(2);
    #[doc(alias = "UITextBorderStyleRoundedRect")]
    pub const RoundedRect: Self = Self(3);
}

unsafe impl Encode for UITextBorderStyle {
    const ENCODING: Encoding = NSInteger::ENCODING;
}

unsafe impl RefEncode for UITextBorderStyle {
    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}

// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct UITextFieldViewMode(pub NSInteger);
impl UITextFieldViewMode {
    #[doc(alias = "UITextFieldViewModeNever")]
    pub const Never: Self = Self(0);
    #[doc(alias = "UITextFieldViewModeWhileEditing")]
    pub const WhileEditing: Self = Self(1);
    #[doc(alias = "UITextFieldViewModeUnlessEditing")]
    pub const UnlessEditing: Self = Self(2);
    #[doc(alias = "UITextFieldViewModeAlways")]
    pub const Always: Self = Self(3);
}

unsafe impl Encode for UITextFieldViewMode {
    const ENCODING: Encoding = NSInteger::ENCODING;
}

unsafe impl RefEncode for UITextFieldViewMode {
    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}

// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct UITextFieldDidEndEditingReason(pub NSInteger);
impl UITextFieldDidEndEditingReason {
    #[doc(alias = "UITextFieldDidEndEditingReasonCommitted")]
    pub const Committed: Self = Self(0);
    #[doc(alias = "UITextFieldDidEndEditingReasonCancelled")]
    pub const Cancelled: Self = Self(1);
}

unsafe impl Encode for UITextFieldDidEndEditingReason {
    const ENCODING: Encoding = NSInteger::ENCODING;
}

unsafe impl RefEncode for UITextFieldDidEndEditingReason {
    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}

extern_class!(
    #[derive(Debug, PartialEq, Eq, Hash)]
    #[cfg(all(feature = "UIControl", feature = "UIResponder", feature = "UIView"))]
    pub struct UITextField;

    #[cfg(all(feature = "UIControl", feature = "UIResponder", feature = "UIView"))]
    unsafe impl ClassType for UITextField {
        #[inherits(UIView, UIResponder, NSObject)]
        type Super = UIControl;
        type Mutability = MainThreadOnly;
    }
);

#[cfg(all(
    feature = "UIControl",
    feature = "UIResponder",
    feature = "UIView",
    feature = "objc2-quartz-core"
))]
#[cfg(not(target_os = "watchos"))]
unsafe impl CALayerDelegate for UITextField {}

#[cfg(all(feature = "UIControl", feature = "UIResponder", feature = "UIView"))]
unsafe impl NSCoding for UITextField {}

#[cfg(all(feature = "UIControl", feature = "UIResponder", feature = "UIView"))]
unsafe impl NSObjectProtocol for UITextField {}

#[cfg(all(
    feature = "UIAppearance",
    feature = "UIControl",
    feature = "UIResponder",
    feature = "UIView"
))]
unsafe impl UIAppearance for UITextField {}

#[cfg(all(
    feature = "UIAppearance",
    feature = "UIControl",
    feature = "UIResponder",
    feature = "UIView"
))]
unsafe impl UIAppearanceContainer for UITextField {}

#[cfg(all(
    feature = "UIContentSizeCategoryAdjusting",
    feature = "UIControl",
    feature = "UIResponder",
    feature = "UIView"
))]
unsafe impl UIContentSizeCategoryAdjusting for UITextField {}

#[cfg(all(feature = "UIControl", feature = "UIResponder", feature = "UIView"))]
unsafe impl UICoordinateSpace for UITextField {}

#[cfg(all(
    feature = "UIControl",
    feature = "UIDynamicBehavior",
    feature = "UIResponder",
    feature = "UIView"
))]
unsafe impl UIDynamicItem for UITextField {}

#[cfg(all(
    feature = "UIControl",
    feature = "UIFocus",
    feature = "UIResponder",
    feature = "UIView"
))]
unsafe impl UIFocusEnvironment for UITextField {}

#[cfg(all(
    feature = "UIControl",
    feature = "UIFocus",
    feature = "UIResponder",
    feature = "UIView"
))]
unsafe impl UIFocusItem for UITextField {}

#[cfg(all(
    feature = "UIControl",
    feature = "UIFocus",
    feature = "UIResponder",
    feature = "UIView"
))]
unsafe impl UIFocusItemContainer for UITextField {}

#[cfg(all(
    feature = "UIControl",
    feature = "UIResponder",
    feature = "UITextInput",
    feature = "UITextInputTraits",
    feature = "UIView"
))]
unsafe impl UIKeyInput for UITextField {}

#[cfg(all(
    feature = "UIControl",
    feature = "UILetterformAwareAdjusting",
    feature = "UIResponder",
    feature = "UIView"
))]
unsafe impl UILetterformAwareAdjusting for UITextField {}

#[cfg(all(feature = "UIControl", feature = "UIResponder", feature = "UIView"))]
unsafe impl UIResponderStandardEditActions for UITextField {}

#[cfg(all(
    feature = "UIControl",
    feature = "UIResponder",
    feature = "UITextInput",
    feature = "UITextInputTraits",
    feature = "UIView"
))]
unsafe impl UITextInput for UITextField {}

#[cfg(all(
    feature = "UIControl",
    feature = "UIResponder",
    feature = "UITextInputTraits",
    feature = "UIView"
))]
unsafe impl UITextInputTraits for UITextField {}

#[cfg(all(
    feature = "UIControl",
    feature = "UIResponder",
    feature = "UITraitCollection",
    feature = "UIView"
))]
unsafe impl UITraitEnvironment for UITextField {}

extern_methods!(
    #[cfg(all(feature = "UIControl", feature = "UIResponder", feature = "UIView"))]
    unsafe impl UITextField {
        #[method_id(@__retain_semantics Other text)]
        pub unsafe fn text(&self) -> Option<Retained<NSString>>;

        #[method(setText:)]
        pub unsafe fn setText(&self, text: Option<&NSString>);

        #[method_id(@__retain_semantics Other attributedText)]
        pub unsafe fn attributedText(&self) -> Option<Retained<NSAttributedString>>;

        #[method(setAttributedText:)]
        pub unsafe fn setAttributedText(&self, attributed_text: Option<&NSAttributedString>);

        #[cfg(feature = "UIColor")]
        #[method_id(@__retain_semantics Other textColor)]
        pub unsafe fn textColor(&self) -> Option<Retained<UIColor>>;

        #[cfg(feature = "UIColor")]
        #[method(setTextColor:)]
        pub unsafe fn setTextColor(&self, text_color: Option<&UIColor>);

        #[cfg(feature = "UIFont")]
        #[method_id(@__retain_semantics Other font)]
        pub unsafe fn font(&self) -> Option<Retained<UIFont>>;

        #[cfg(feature = "UIFont")]
        #[method(setFont:)]
        pub unsafe fn setFont(&self, font: Option<&UIFont>);

        #[cfg(feature = "NSText")]
        #[method(textAlignment)]
        pub unsafe fn textAlignment(&self) -> NSTextAlignment;

        #[cfg(feature = "NSText")]
        #[method(setTextAlignment:)]
        pub unsafe fn setTextAlignment(&self, text_alignment: NSTextAlignment);

        #[method(borderStyle)]
        pub unsafe fn borderStyle(&self) -> UITextBorderStyle;

        #[method(setBorderStyle:)]
        pub unsafe fn setBorderStyle(&self, border_style: UITextBorderStyle);

        #[method_id(@__retain_semantics Other defaultTextAttributes)]
        pub unsafe fn defaultTextAttributes(
            &self,
        ) -> Retained<NSDictionary<NSAttributedStringKey, AnyObject>>;

        #[method(setDefaultTextAttributes:)]
        pub unsafe fn setDefaultTextAttributes(
            &self,
            default_text_attributes: &NSDictionary<NSAttributedStringKey, AnyObject>,
        );

        #[method_id(@__retain_semantics Other placeholder)]
        pub unsafe fn placeholder(&self) -> Option<Retained<NSString>>;

        #[method(setPlaceholder:)]
        pub unsafe fn setPlaceholder(&self, placeholder: Option<&NSString>);

        #[method_id(@__retain_semantics Other attributedPlaceholder)]
        pub unsafe fn attributedPlaceholder(&self) -> Option<Retained<NSAttributedString>>;

        #[method(setAttributedPlaceholder:)]
        pub unsafe fn setAttributedPlaceholder(
            &self,
            attributed_placeholder: Option<&NSAttributedString>,
        );

        #[method(clearsOnBeginEditing)]
        pub unsafe fn clearsOnBeginEditing(&self) -> bool;

        #[method(setClearsOnBeginEditing:)]
        pub unsafe fn setClearsOnBeginEditing(&self, clears_on_begin_editing: bool);

        #[method(adjustsFontSizeToFitWidth)]
        pub unsafe fn adjustsFontSizeToFitWidth(&self) -> bool;

        #[method(setAdjustsFontSizeToFitWidth:)]
        pub unsafe fn setAdjustsFontSizeToFitWidth(&self, adjusts_font_size_to_fit_width: bool);

        #[method(minimumFontSize)]
        pub unsafe fn minimumFontSize(&self) -> CGFloat;

        #[method(setMinimumFontSize:)]
        pub unsafe fn setMinimumFontSize(&self, minimum_font_size: CGFloat);

        #[method_id(@__retain_semantics Other delegate)]
        pub unsafe fn delegate(&self) -> Option<Retained<ProtocolObject<dyn UITextFieldDelegate>>>;

        #[method(setDelegate:)]
        pub unsafe fn setDelegate(
            &self,
            delegate: Option<&ProtocolObject<dyn UITextFieldDelegate>>,
        );

        #[cfg(feature = "UIImage")]
        #[method_id(@__retain_semantics Other background)]
        pub unsafe fn background(&self) -> Option<Retained<UIImage>>;

        #[cfg(feature = "UIImage")]
        #[method(setBackground:)]
        pub unsafe fn setBackground(&self, background: Option<&UIImage>);

        #[cfg(feature = "UIImage")]
        #[method_id(@__retain_semantics Other disabledBackground)]
        pub unsafe fn disabledBackground(&self) -> Option<Retained<UIImage>>;

        #[cfg(feature = "UIImage")]
        #[method(setDisabledBackground:)]
        pub unsafe fn setDisabledBackground(&self, disabled_background: Option<&UIImage>);

        #[method(isEditing)]
        pub unsafe fn isEditing(&self) -> bool;

        #[method(allowsEditingTextAttributes)]
        pub unsafe fn allowsEditingTextAttributes(&self) -> bool;

        #[method(setAllowsEditingTextAttributes:)]
        pub unsafe fn setAllowsEditingTextAttributes(&self, allows_editing_text_attributes: bool);

        #[method_id(@__retain_semantics Other typingAttributes)]
        pub unsafe fn typingAttributes(
            &self,
        ) -> Option<Retained<NSDictionary<NSAttributedStringKey, AnyObject>>>;

        #[method(setTypingAttributes:)]
        pub unsafe fn setTypingAttributes(
            &self,
            typing_attributes: Option<&NSDictionary<NSAttributedStringKey, AnyObject>>,
        );

        #[method(clearButtonMode)]
        pub unsafe fn clearButtonMode(&self) -> UITextFieldViewMode;

        #[method(setClearButtonMode:)]
        pub unsafe fn setClearButtonMode(&self, clear_button_mode: UITextFieldViewMode);

        #[method_id(@__retain_semantics Other leftView)]
        pub unsafe fn leftView(&self) -> Option<Retained<UIView>>;

        #[method(setLeftView:)]
        pub unsafe fn setLeftView(&self, left_view: Option<&UIView>);

        #[method(leftViewMode)]
        pub unsafe fn leftViewMode(&self) -> UITextFieldViewMode;

        #[method(setLeftViewMode:)]
        pub unsafe fn setLeftViewMode(&self, left_view_mode: UITextFieldViewMode);

        #[method_id(@__retain_semantics Other rightView)]
        pub unsafe fn rightView(&self) -> Option<Retained<UIView>>;

        #[method(setRightView:)]
        pub unsafe fn setRightView(&self, right_view: Option<&UIView>);

        #[method(rightViewMode)]
        pub unsafe fn rightViewMode(&self) -> UITextFieldViewMode;

        #[method(setRightViewMode:)]
        pub unsafe fn setRightViewMode(&self, right_view_mode: UITextFieldViewMode);

        #[method(borderRectForBounds:)]
        pub unsafe fn borderRectForBounds(&self, bounds: CGRect) -> CGRect;

        #[method(textRectForBounds:)]
        pub unsafe fn textRectForBounds(&self, bounds: CGRect) -> CGRect;

        #[method(placeholderRectForBounds:)]
        pub unsafe fn placeholderRectForBounds(&self, bounds: CGRect) -> CGRect;

        #[method(editingRectForBounds:)]
        pub unsafe fn editingRectForBounds(&self, bounds: CGRect) -> CGRect;

        #[method(clearButtonRectForBounds:)]
        pub unsafe fn clearButtonRectForBounds(&self, bounds: CGRect) -> CGRect;

        #[method(leftViewRectForBounds:)]
        pub unsafe fn leftViewRectForBounds(&self, bounds: CGRect) -> CGRect;

        #[method(rightViewRectForBounds:)]
        pub unsafe fn rightViewRectForBounds(&self, bounds: CGRect) -> CGRect;

        #[deprecated = "This method is no longer called."]
        #[method(drawTextInRect:)]
        pub unsafe fn drawTextInRect(&self, rect: CGRect);

        #[method(drawPlaceholderInRect:)]
        pub unsafe fn drawPlaceholderInRect(&self, rect: CGRect);

        #[method_id(@__retain_semantics Other inputView)]
        pub unsafe fn inputView(&self) -> Option<Retained<UIView>>;

        #[method(setInputView:)]
        pub unsafe fn setInputView(&self, input_view: Option<&UIView>);

        #[method_id(@__retain_semantics Other inputAccessoryView)]
        pub unsafe fn inputAccessoryView(&self) -> Option<Retained<UIView>>;

        #[method(setInputAccessoryView:)]
        pub unsafe fn setInputAccessoryView(&self, input_accessory_view: Option<&UIView>);

        #[method(clearsOnInsertion)]
        pub unsafe fn clearsOnInsertion(&self) -> bool;

        #[method(setClearsOnInsertion:)]
        pub unsafe fn setClearsOnInsertion(&self, clears_on_insertion: bool);
    }
);

extern_methods!(
    /// Methods declared on superclass `UIControl`
    #[cfg(all(feature = "UIControl", feature = "UIResponder", feature = "UIView"))]
    unsafe impl UITextField {
        #[method_id(@__retain_semantics Init initWithFrame:)]
        pub unsafe fn initWithFrame(this: Allocated<Self>, frame: CGRect) -> Retained<Self>;

        #[method_id(@__retain_semantics Init initWithCoder:)]
        pub unsafe fn initWithCoder(
            this: Allocated<Self>,
            coder: &NSCoder,
        ) -> Option<Retained<Self>>;

        #[cfg(all(feature = "UIAction", feature = "UIMenuElement"))]
        #[method_id(@__retain_semantics Init initWithFrame:primaryAction:)]
        pub unsafe fn initWithFrame_primaryAction(
            this: Allocated<Self>,
            frame: CGRect,
            primary_action: Option<&UIAction>,
        ) -> Retained<Self>;
    }
);

extern_methods!(
    /// Methods declared on superclass `NSObject`
    #[cfg(all(feature = "UIControl", feature = "UIResponder", feature = "UIView"))]
    unsafe impl UITextField {
        #[method_id(@__retain_semantics Init init)]
        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;

        #[method_id(@__retain_semantics New new)]
        pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
    }
);

extern_methods!(
    #[cfg(all(feature = "UIControl", feature = "UIResponder", feature = "UIView"))]
    unsafe impl UITextField {}
);

#[cfg(all(
    feature = "UIControl",
    feature = "UIResponder",
    feature = "UITextDragging",
    feature = "UITextInput",
    feature = "UITextInputTraits",
    feature = "UIView"
))]
unsafe impl UITextDraggable for UITextField {}

#[cfg(all(
    feature = "UIControl",
    feature = "UIPasteConfigurationSupporting",
    feature = "UIResponder",
    feature = "UITextDropping",
    feature = "UITextInput",
    feature = "UITextInputTraits",
    feature = "UITextPasteConfigurationSupporting",
    feature = "UIView"
))]
unsafe impl UITextDroppable for UITextField {}

#[cfg(all(
    feature = "UIControl",
    feature = "UIPasteConfigurationSupporting",
    feature = "UIResponder",
    feature = "UITextPasteConfigurationSupporting",
    feature = "UIView"
))]
unsafe impl UITextPasteConfigurationSupporting for UITextField {}

extern_methods!(
    /// UIInteractionStateRestorable
    #[cfg(all(feature = "UIControl", feature = "UIResponder", feature = "UIView"))]
    unsafe impl UITextField {
        #[method_id(@__retain_semantics Other interactionState)]
        pub unsafe fn interactionState(&self) -> Retained<AnyObject>;

        #[method(setInteractionState:)]
        pub unsafe fn setInteractionState(&self, interaction_state: &AnyObject);
    }
);

extern_methods!(
    /// UITextField
    #[cfg(all(feature = "UIResponder", feature = "UIView"))]
    unsafe impl UIView {
        #[method(endEditing:)]
        pub unsafe fn endEditing(&self, force: bool) -> bool;
    }
);

extern_protocol!(
    pub unsafe trait UITextFieldDelegate: NSObjectProtocol + IsMainThreadOnly {
        #[cfg(all(feature = "UIControl", feature = "UIResponder", feature = "UIView"))]
        #[optional]
        #[method(textFieldShouldBeginEditing:)]
        unsafe fn textFieldShouldBeginEditing(&self, text_field: &UITextField) -> bool;

        #[cfg(all(feature = "UIControl", feature = "UIResponder", feature = "UIView"))]
        #[optional]
        #[method(textFieldDidBeginEditing:)]
        unsafe fn textFieldDidBeginEditing(&self, text_field: &UITextField);

        #[cfg(all(feature = "UIControl", feature = "UIResponder", feature = "UIView"))]
        #[optional]
        #[method(textFieldShouldEndEditing:)]
        unsafe fn textFieldShouldEndEditing(&self, text_field: &UITextField) -> bool;

        #[cfg(all(feature = "UIControl", feature = "UIResponder", feature = "UIView"))]
        #[optional]
        #[method(textFieldDidEndEditing:)]
        unsafe fn textFieldDidEndEditing(&self, text_field: &UITextField);

        #[cfg(all(feature = "UIControl", feature = "UIResponder", feature = "UIView"))]
        #[optional]
        #[method(textFieldDidEndEditing:reason:)]
        unsafe fn textFieldDidEndEditing_reason(
            &self,
            text_field: &UITextField,
            reason: UITextFieldDidEndEditingReason,
        );

        #[cfg(all(feature = "UIControl", feature = "UIResponder", feature = "UIView"))]
        #[optional]
        #[method(textField:shouldChangeCharactersInRange:replacementString:)]
        unsafe fn textField_shouldChangeCharactersInRange_replacementString(
            &self,
            text_field: &UITextField,
            range: NSRange,
            string: &NSString,
        ) -> bool;

        #[cfg(all(feature = "UIControl", feature = "UIResponder", feature = "UIView"))]
        #[optional]
        #[method(textFieldDidChangeSelection:)]
        unsafe fn textFieldDidChangeSelection(&self, text_field: &UITextField);

        #[cfg(all(feature = "UIControl", feature = "UIResponder", feature = "UIView"))]
        #[optional]
        #[method(textFieldShouldClear:)]
        unsafe fn textFieldShouldClear(&self, text_field: &UITextField) -> bool;

        #[cfg(all(feature = "UIControl", feature = "UIResponder", feature = "UIView"))]
        #[optional]
        #[method(textFieldShouldReturn:)]
        unsafe fn textFieldShouldReturn(&self, text_field: &UITextField) -> bool;

        #[cfg(all(
            feature = "UIControl",
            feature = "UIMenu",
            feature = "UIMenuElement",
            feature = "UIResponder",
            feature = "UIView"
        ))]
        #[optional]
        #[method_id(@__retain_semantics Other textField:editMenuForCharactersInRange:suggestedActions:)]
        unsafe fn textField_editMenuForCharactersInRange_suggestedActions(
            &self,
            text_field: &UITextField,
            range: NSRange,
            suggested_actions: &NSArray<UIMenuElement>,
        ) -> Option<Retained<UIMenu>>;

        #[cfg(all(
            feature = "UIControl",
            feature = "UIEditMenuInteraction",
            feature = "UIResponder",
            feature = "UIView"
        ))]
        #[optional]
        #[method(textField:willPresentEditMenuWithAnimator:)]
        unsafe fn textField_willPresentEditMenuWithAnimator(
            &self,
            text_field: &UITextField,
            animator: &ProtocolObject<dyn UIEditMenuInteractionAnimating>,
        );

        #[cfg(all(
            feature = "UIControl",
            feature = "UIEditMenuInteraction",
            feature = "UIResponder",
            feature = "UIView"
        ))]
        #[optional]
        #[method(textField:willDismissEditMenuWithAnimator:)]
        unsafe fn textField_willDismissEditMenuWithAnimator(
            &self,
            text_field: &UITextField,
            animator: &ProtocolObject<dyn UIEditMenuInteractionAnimating>,
        );
    }

    unsafe impl ProtocolType for dyn UITextFieldDelegate {}
);

extern "C" {
    pub static UITextFieldTextDidBeginEditingNotification: &'static NSNotificationName;
}

extern "C" {
    pub static UITextFieldTextDidEndEditingNotification: &'static NSNotificationName;
}

extern "C" {
    pub static UITextFieldTextDidChangeNotification: &'static NSNotificationName;
}

extern "C" {
    pub static UITextFieldDidEndEditingReasonKey: &'static NSString;
}