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
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use objc2::__framework_prelude::*;
use objc2_foundation::*;

use crate::*;

#[cfg(feature = "block2")]
pub type UITextAttributesConversionHandler = *mut block2::Block<
    dyn Fn(
        NonNull<NSDictionary<NSAttributedStringKey, AnyObject>>,
    ) -> NonNull<NSDictionary<NSAttributedStringKey, AnyObject>>,
>;

// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct UIEditingInteractionConfiguration(pub NSInteger);
impl UIEditingInteractionConfiguration {
    #[doc(alias = "UIEditingInteractionConfigurationNone")]
    pub const None: Self = Self(0);
    #[doc(alias = "UIEditingInteractionConfigurationDefault")]
    pub const Default: Self = Self(1);
}

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

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

extern_protocol!(
    pub unsafe trait UIResponderStandardEditActions:
        NSObjectProtocol + IsMainThreadOnly
    {
        #[optional]
        #[method(cut:)]
        unsafe fn cut(&self, sender: Option<&AnyObject>);

        #[optional]
        #[method(copy:)]
        unsafe fn copy(&self, sender: Option<&AnyObject>);

        #[optional]
        #[method(paste:)]
        unsafe fn paste(&self, sender: Option<&AnyObject>);

        #[optional]
        #[method(pasteAndMatchStyle:)]
        unsafe fn pasteAndMatchStyle(&self, sender: Option<&AnyObject>);

        #[optional]
        #[method(pasteAndGo:)]
        unsafe fn pasteAndGo(&self, sender: Option<&AnyObject>);

        #[optional]
        #[method(pasteAndSearch:)]
        unsafe fn pasteAndSearch(&self, sender: Option<&AnyObject>);

        #[optional]
        #[method(select:)]
        unsafe fn select(&self, sender: Option<&AnyObject>);

        #[optional]
        #[method(selectAll:)]
        unsafe fn selectAll(&self, sender: Option<&AnyObject>);

        #[optional]
        #[method(delete:)]
        unsafe fn delete(&self, sender: Option<&AnyObject>);

        #[optional]
        #[method(makeTextWritingDirectionLeftToRight:)]
        unsafe fn makeTextWritingDirectionLeftToRight(&self, sender: Option<&AnyObject>);

        #[optional]
        #[method(makeTextWritingDirectionRightToLeft:)]
        unsafe fn makeTextWritingDirectionRightToLeft(&self, sender: Option<&AnyObject>);

        #[optional]
        #[method(toggleBoldface:)]
        unsafe fn toggleBoldface(&self, sender: Option<&AnyObject>);

        #[optional]
        #[method(toggleItalics:)]
        unsafe fn toggleItalics(&self, sender: Option<&AnyObject>);

        #[optional]
        #[method(toggleUnderline:)]
        unsafe fn toggleUnderline(&self, sender: Option<&AnyObject>);

        #[optional]
        #[method(increaseSize:)]
        unsafe fn increaseSize(&self, sender: Option<&AnyObject>);

        #[optional]
        #[method(decreaseSize:)]
        unsafe fn decreaseSize(&self, sender: Option<&AnyObject>);

        #[optional]
        #[method(find:)]
        unsafe fn find(&self, sender: Option<&AnyObject>);

        #[optional]
        #[method(findAndReplace:)]
        unsafe fn findAndReplace(&self, sender: Option<&AnyObject>);

        #[optional]
        #[method(findNext:)]
        unsafe fn findNext(&self, sender: Option<&AnyObject>);

        #[optional]
        #[method(findPrevious:)]
        unsafe fn findPrevious(&self, sender: Option<&AnyObject>);

        #[optional]
        #[method(useSelectionForFind:)]
        unsafe fn useSelectionForFind(&self, sender: Option<&AnyObject>);

        #[cfg(feature = "block2")]
        #[optional]
        #[method(updateTextAttributesWithConversionHandler:)]
        unsafe fn updateTextAttributesWithConversionHandler(
            &self,
            conversion_handler: UITextAttributesConversionHandler,
        );

        #[optional]
        #[method(print:)]
        unsafe fn print(&self, sender: Option<&AnyObject>);

        #[optional]
        #[method(rename:)]
        unsafe fn rename(&self, sender: Option<&AnyObject>);

        #[optional]
        #[method(duplicate:)]
        unsafe fn duplicate(&self, sender: Option<&AnyObject>);

        #[optional]
        #[method(move:)]
        unsafe fn r#move(&self, sender: Option<&AnyObject>);

        #[optional]
        #[method(export:)]
        unsafe fn export(&self, sender: Option<&AnyObject>);
    }

    unsafe impl ProtocolType for dyn UIResponderStandardEditActions {}
);

extern_class!(
    #[derive(Debug, PartialEq, Eq, Hash)]
    pub struct UIResponder;

    unsafe impl ClassType for UIResponder {
        type Super = NSObject;
        type Mutability = MainThreadOnly;
    }
);

unsafe impl NSObjectProtocol for UIResponder {}

unsafe impl UIResponderStandardEditActions for UIResponder {}

extern_methods!(
    unsafe impl UIResponder {
        #[method_id(@__retain_semantics Other nextResponder)]
        pub unsafe fn nextResponder(&self) -> Option<Retained<UIResponder>>;

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

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

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

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

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

        #[cfg(all(feature = "UIEvent", feature = "UITouch"))]
        #[method(touchesBegan:withEvent:)]
        pub unsafe fn touchesBegan_withEvent(
            &self,
            touches: &NSSet<UITouch>,
            event: Option<&UIEvent>,
        );

        #[cfg(all(feature = "UIEvent", feature = "UITouch"))]
        #[method(touchesMoved:withEvent:)]
        pub unsafe fn touchesMoved_withEvent(
            &self,
            touches: &NSSet<UITouch>,
            event: Option<&UIEvent>,
        );

        #[cfg(all(feature = "UIEvent", feature = "UITouch"))]
        #[method(touchesEnded:withEvent:)]
        pub unsafe fn touchesEnded_withEvent(
            &self,
            touches: &NSSet<UITouch>,
            event: Option<&UIEvent>,
        );

        #[cfg(all(feature = "UIEvent", feature = "UITouch"))]
        #[method(touchesCancelled:withEvent:)]
        pub unsafe fn touchesCancelled_withEvent(
            &self,
            touches: &NSSet<UITouch>,
            event: Option<&UIEvent>,
        );

        #[cfg(feature = "UITouch")]
        #[method(touchesEstimatedPropertiesUpdated:)]
        pub unsafe fn touchesEstimatedPropertiesUpdated(&self, touches: &NSSet<UITouch>);

        #[cfg(all(feature = "UIEvent", feature = "UIPress", feature = "UIPressesEvent"))]
        #[method(pressesBegan:withEvent:)]
        pub unsafe fn pressesBegan_withEvent(
            &self,
            presses: &NSSet<UIPress>,
            event: Option<&UIPressesEvent>,
        );

        #[cfg(all(feature = "UIEvent", feature = "UIPress", feature = "UIPressesEvent"))]
        #[method(pressesChanged:withEvent:)]
        pub unsafe fn pressesChanged_withEvent(
            &self,
            presses: &NSSet<UIPress>,
            event: Option<&UIPressesEvent>,
        );

        #[cfg(all(feature = "UIEvent", feature = "UIPress", feature = "UIPressesEvent"))]
        #[method(pressesEnded:withEvent:)]
        pub unsafe fn pressesEnded_withEvent(
            &self,
            presses: &NSSet<UIPress>,
            event: Option<&UIPressesEvent>,
        );

        #[cfg(all(feature = "UIEvent", feature = "UIPress", feature = "UIPressesEvent"))]
        #[method(pressesCancelled:withEvent:)]
        pub unsafe fn pressesCancelled_withEvent(
            &self,
            presses: &NSSet<UIPress>,
            event: Option<&UIPressesEvent>,
        );

        #[cfg(feature = "UIEvent")]
        #[method(motionBegan:withEvent:)]
        pub unsafe fn motionBegan_withEvent(&self, motion: UIEventSubtype, event: Option<&UIEvent>);

        #[cfg(feature = "UIEvent")]
        #[method(motionEnded:withEvent:)]
        pub unsafe fn motionEnded_withEvent(&self, motion: UIEventSubtype, event: Option<&UIEvent>);

        #[cfg(feature = "UIEvent")]
        #[method(motionCancelled:withEvent:)]
        pub unsafe fn motionCancelled_withEvent(
            &self,
            motion: UIEventSubtype,
            event: Option<&UIEvent>,
        );

        #[cfg(feature = "UIEvent")]
        #[method(remoteControlReceivedWithEvent:)]
        pub unsafe fn remoteControlReceivedWithEvent(&self, event: Option<&UIEvent>);

        #[method(canPerformAction:withSender:)]
        pub unsafe fn canPerformAction_withSender(
            &self,
            action: Sel,
            sender: Option<&AnyObject>,
        ) -> bool;

        #[method_id(@__retain_semantics Other targetForAction:withSender:)]
        pub unsafe fn targetForAction_withSender(
            &self,
            action: Sel,
            sender: Option<&AnyObject>,
        ) -> Option<Retained<AnyObject>>;

        #[cfg(feature = "UIMenuBuilder")]
        #[method(buildMenuWithBuilder:)]
        pub unsafe fn buildMenuWithBuilder(&self, builder: &ProtocolObject<dyn UIMenuBuilder>);

        #[cfg(all(feature = "UICommand", feature = "UIMenuElement"))]
        #[method(validateCommand:)]
        pub unsafe fn validateCommand(&self, command: &UICommand);

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

        #[method(editingInteractionConfiguration)]
        pub unsafe fn editingInteractionConfiguration(&self) -> UIEditingInteractionConfiguration;
    }
);

extern_methods!(
    /// Methods declared on superclass `NSObject`
    unsafe impl UIResponder {
        #[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!(
    /// UIResponderKeyCommands
    unsafe impl UIResponder {
        #[cfg(all(
            feature = "UICommand",
            feature = "UIKeyCommand",
            feature = "UIMenuElement"
        ))]
        #[method_id(@__retain_semantics Other keyCommands)]
        pub unsafe fn keyCommands(&self) -> Option<Retained<NSArray<UIKeyCommand>>>;
    }
);

extern_methods!(
    /// UIResponderInputViewAdditions
    unsafe impl UIResponder {
        #[cfg(feature = "UIView")]
        #[method_id(@__retain_semantics Other inputView)]
        pub unsafe fn inputView(&self) -> Option<Retained<UIView>>;

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

        #[cfg(feature = "UITextInput")]
        #[method_id(@__retain_semantics Other inputAssistantItem)]
        pub unsafe fn inputAssistantItem(&self) -> Retained<UITextInputAssistantItem>;

        #[cfg(all(feature = "UIInputViewController", feature = "UIViewController"))]
        #[method_id(@__retain_semantics Other inputViewController)]
        pub unsafe fn inputViewController(&self) -> Option<Retained<UIInputViewController>>;

        #[cfg(all(feature = "UIInputViewController", feature = "UIViewController"))]
        #[method_id(@__retain_semantics Other inputAccessoryViewController)]
        pub unsafe fn inputAccessoryViewController(
            &self,
        ) -> Option<Retained<UIInputViewController>>;

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

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

        #[method(clearTextInputContextIdentifier:)]
        pub unsafe fn clearTextInputContextIdentifier(identifier: &NSString, mtm: MainThreadMarker);

        #[method(reloadInputViews)]
        pub unsafe fn reloadInputViews(&self);
    }
);

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

extern_methods!(
    /// ActivityContinuation
    unsafe impl UIResponder {
        #[method_id(@__retain_semantics Other userActivity)]
        pub unsafe fn userActivity(&self) -> Option<Retained<NSUserActivity>>;

        #[method(setUserActivity:)]
        pub unsafe fn setUserActivity(&self, user_activity: Option<&NSUserActivity>);

        #[method(updateUserActivityState:)]
        pub unsafe fn updateUserActivityState(&self, activity: &NSUserActivity);

        #[method(restoreUserActivityState:)]
        pub unsafe fn restoreUserActivityState(&self, activity: &NSUserActivity);
    }
);

#[cfg(feature = "UIUserActivity")]
unsafe impl UIUserActivityRestoring for UIResponder {}

extern_methods!(
    /// UIPasteConfigurationSupporting
    unsafe impl UIResponder {}
);

#[cfg(feature = "UIPasteConfigurationSupporting")]
unsafe impl UIPasteConfigurationSupporting for UIResponder {}

extern_methods!(
    /// UICaptureTextFromCameraSupporting
    unsafe impl UIResponder {
        #[method(captureTextFromCamera:)]
        pub unsafe fn captureTextFromCamera(&self, sender: Option<&AnyObject>);
    }
);