objc2-foundation 0.3.2

Bindings to the Foundation framework
Documentation
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
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use core::ffi::*;
use core::ptr::NonNull;
use objc2::__framework_prelude::*;

use crate::*;

/// [Apple's documentation](https://developer.apple.com/documentation/foundation/nsusernotificationactivationtype?language=objc)
// NS_ENUM
#[deprecated = "All NSUserNotifications API should be replaced with UserNotifications.frameworks API"]
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSUserNotificationActivationType(pub NSInteger);
impl NSUserNotificationActivationType {
    #[doc(alias = "NSUserNotificationActivationTypeNone")]
    #[deprecated = "All NSUserNotifications API should be replaced with UserNotifications.frameworks API"]
    pub const None: Self = Self(0);
    #[doc(alias = "NSUserNotificationActivationTypeContentsClicked")]
    #[deprecated = "All NSUserNotifications API should be replaced with UserNotifications.frameworks API"]
    pub const ContentsClicked: Self = Self(1);
    #[doc(alias = "NSUserNotificationActivationTypeActionButtonClicked")]
    #[deprecated = "All NSUserNotifications API should be replaced with UserNotifications.frameworks API"]
    pub const ActionButtonClicked: Self = Self(2);
    #[doc(alias = "NSUserNotificationActivationTypeReplied")]
    pub const Replied: Self = Self(3);
    #[doc(alias = "NSUserNotificationActivationTypeAdditionalActionClicked")]
    pub const AdditionalActionClicked: Self = Self(4);
}

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

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

extern_class!(
    /// [Apple's documentation](https://developer.apple.com/documentation/foundation/nsusernotification?language=objc)
    #[unsafe(super(NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    #[deprecated = "All NSUserNotifications API should be replaced with UserNotifications.frameworks API"]
    pub struct NSUserNotification;
);

#[cfg(feature = "NSObject")]
extern_conformance!(
    unsafe impl NSCopying for NSUserNotification {}
);

#[cfg(feature = "NSObject")]
unsafe impl CopyingHelper for NSUserNotification {
    type Result = Self;
}

extern_conformance!(
    unsafe impl NSObjectProtocol for NSUserNotification {}
);

impl NSUserNotification {
    extern_methods!(
        #[deprecated = "All NSUserNotifications API should be replaced with UserNotifications.frameworks API"]
        #[unsafe(method(init))]
        #[unsafe(method_family = init)]
        pub fn init(this: Allocated<Self>) -> Retained<Self>;

        #[cfg(feature = "NSString")]
        #[deprecated = "All NSUserNotifications API should be replaced with UserNotifications.frameworks API"]
        #[unsafe(method(title))]
        #[unsafe(method_family = none)]
        pub fn title(&self) -> Option<Retained<NSString>>;

        #[cfg(feature = "NSString")]
        /// Setter for [`title`][Self::title].
        ///
        /// This is [copied][crate::NSCopying::copy] when set.
        #[deprecated = "All NSUserNotifications API should be replaced with UserNotifications.frameworks API"]
        #[unsafe(method(setTitle:))]
        #[unsafe(method_family = none)]
        pub fn setTitle(&self, title: Option<&NSString>);

        #[cfg(feature = "NSString")]
        #[deprecated = "All NSUserNotifications API should be replaced with UserNotifications.frameworks API"]
        #[unsafe(method(subtitle))]
        #[unsafe(method_family = none)]
        pub fn subtitle(&self) -> Option<Retained<NSString>>;

        #[cfg(feature = "NSString")]
        /// Setter for [`subtitle`][Self::subtitle].
        ///
        /// This is [copied][crate::NSCopying::copy] when set.
        #[deprecated = "All NSUserNotifications API should be replaced with UserNotifications.frameworks API"]
        #[unsafe(method(setSubtitle:))]
        #[unsafe(method_family = none)]
        pub fn setSubtitle(&self, subtitle: Option<&NSString>);

        #[cfg(feature = "NSString")]
        #[deprecated = "All NSUserNotifications API should be replaced with UserNotifications.frameworks API"]
        #[unsafe(method(informativeText))]
        #[unsafe(method_family = none)]
        pub fn informativeText(&self) -> Option<Retained<NSString>>;

        #[cfg(feature = "NSString")]
        /// Setter for [`informativeText`][Self::informativeText].
        ///
        /// This is [copied][crate::NSCopying::copy] when set.
        #[deprecated = "All NSUserNotifications API should be replaced with UserNotifications.frameworks API"]
        #[unsafe(method(setInformativeText:))]
        #[unsafe(method_family = none)]
        pub fn setInformativeText(&self, informative_text: Option<&NSString>);

        #[cfg(feature = "NSString")]
        #[deprecated = "All NSUserNotifications API should be replaced with UserNotifications.frameworks API"]
        #[unsafe(method(actionButtonTitle))]
        #[unsafe(method_family = none)]
        pub fn actionButtonTitle(&self) -> Retained<NSString>;

        #[cfg(feature = "NSString")]
        /// Setter for [`actionButtonTitle`][Self::actionButtonTitle].
        ///
        /// This is [copied][crate::NSCopying::copy] when set.
        #[deprecated = "All NSUserNotifications API should be replaced with UserNotifications.frameworks API"]
        #[unsafe(method(setActionButtonTitle:))]
        #[unsafe(method_family = none)]
        pub fn setActionButtonTitle(&self, action_button_title: &NSString);

        #[cfg(all(feature = "NSDictionary", feature = "NSString"))]
        #[deprecated = "All NSUserNotifications API should be replaced with UserNotifications.frameworks API"]
        #[unsafe(method(userInfo))]
        #[unsafe(method_family = none)]
        pub fn userInfo(&self) -> Option<Retained<NSDictionary<NSString, AnyObject>>>;

        #[cfg(all(feature = "NSDictionary", feature = "NSString"))]
        /// Setter for [`userInfo`][Self::userInfo].
        ///
        /// This is [copied][crate::NSCopying::copy] when set.
        ///
        /// # Safety
        ///
        /// `user_info` generic should be of the correct type.
        #[deprecated = "All NSUserNotifications API should be replaced with UserNotifications.frameworks API"]
        #[unsafe(method(setUserInfo:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setUserInfo(&self, user_info: Option<&NSDictionary<NSString, AnyObject>>);

        #[cfg(feature = "NSDate")]
        #[deprecated = "All NSUserNotifications API should be replaced with UserNotifications.frameworks API"]
        #[unsafe(method(deliveryDate))]
        #[unsafe(method_family = none)]
        pub fn deliveryDate(&self) -> Option<Retained<NSDate>>;

        #[cfg(feature = "NSDate")]
        /// Setter for [`deliveryDate`][Self::deliveryDate].
        ///
        /// This is [copied][crate::NSCopying::copy] when set.
        #[deprecated = "All NSUserNotifications API should be replaced with UserNotifications.frameworks API"]
        #[unsafe(method(setDeliveryDate:))]
        #[unsafe(method_family = none)]
        pub fn setDeliveryDate(&self, delivery_date: Option<&NSDate>);

        #[cfg(feature = "NSTimeZone")]
        #[deprecated = "All NSUserNotifications API should be replaced with UserNotifications.frameworks API"]
        #[unsafe(method(deliveryTimeZone))]
        #[unsafe(method_family = none)]
        pub fn deliveryTimeZone(&self) -> Option<Retained<NSTimeZone>>;

        #[cfg(feature = "NSTimeZone")]
        /// Setter for [`deliveryTimeZone`][Self::deliveryTimeZone].
        ///
        /// This is [copied][crate::NSCopying::copy] when set.
        #[deprecated = "All NSUserNotifications API should be replaced with UserNotifications.frameworks API"]
        #[unsafe(method(setDeliveryTimeZone:))]
        #[unsafe(method_family = none)]
        pub fn setDeliveryTimeZone(&self, delivery_time_zone: Option<&NSTimeZone>);

        #[cfg(feature = "NSCalendar")]
        #[deprecated = "All NSUserNotifications API should be replaced with UserNotifications.frameworks API"]
        #[unsafe(method(deliveryRepeatInterval))]
        #[unsafe(method_family = none)]
        pub fn deliveryRepeatInterval(&self) -> Option<Retained<NSDateComponents>>;

        #[cfg(feature = "NSCalendar")]
        /// Setter for [`deliveryRepeatInterval`][Self::deliveryRepeatInterval].
        ///
        /// This is [copied][crate::NSCopying::copy] when set.
        #[deprecated = "All NSUserNotifications API should be replaced with UserNotifications.frameworks API"]
        #[unsafe(method(setDeliveryRepeatInterval:))]
        #[unsafe(method_family = none)]
        pub fn setDeliveryRepeatInterval(
            &self,
            delivery_repeat_interval: Option<&NSDateComponents>,
        );

        #[cfg(feature = "NSDate")]
        #[deprecated = "All NSUserNotifications API should be replaced with UserNotifications.frameworks API"]
        #[unsafe(method(actualDeliveryDate))]
        #[unsafe(method_family = none)]
        pub fn actualDeliveryDate(&self) -> Option<Retained<NSDate>>;

        #[deprecated = "All NSUserNotifications API should be replaced with UserNotifications.frameworks API"]
        #[unsafe(method(isPresented))]
        #[unsafe(method_family = none)]
        pub fn isPresented(&self) -> bool;

        #[deprecated = "All NSUserNotifications API should be replaced with UserNotifications.frameworks API"]
        #[unsafe(method(isRemote))]
        #[unsafe(method_family = none)]
        pub fn isRemote(&self) -> bool;

        #[cfg(feature = "NSString")]
        #[deprecated = "All NSUserNotifications API should be replaced with UserNotifications.frameworks API"]
        #[unsafe(method(soundName))]
        #[unsafe(method_family = none)]
        pub fn soundName(&self) -> Option<Retained<NSString>>;

        #[cfg(feature = "NSString")]
        /// Setter for [`soundName`][Self::soundName].
        ///
        /// This is [copied][crate::NSCopying::copy] when set.
        #[deprecated = "All NSUserNotifications API should be replaced with UserNotifications.frameworks API"]
        #[unsafe(method(setSoundName:))]
        #[unsafe(method_family = none)]
        pub fn setSoundName(&self, sound_name: Option<&NSString>);

        #[deprecated = "All NSUserNotifications API should be replaced with UserNotifications.frameworks API"]
        #[unsafe(method(hasActionButton))]
        #[unsafe(method_family = none)]
        pub fn hasActionButton(&self) -> bool;

        /// Setter for [`hasActionButton`][Self::hasActionButton].
        #[deprecated = "All NSUserNotifications API should be replaced with UserNotifications.frameworks API"]
        #[unsafe(method(setHasActionButton:))]
        #[unsafe(method_family = none)]
        pub fn setHasActionButton(&self, has_action_button: bool);

        #[deprecated = "All NSUserNotifications API should be replaced with UserNotifications.frameworks API"]
        #[unsafe(method(activationType))]
        #[unsafe(method_family = none)]
        pub fn activationType(&self) -> NSUserNotificationActivationType;

        #[cfg(feature = "NSString")]
        #[deprecated = "All NSUserNotifications API should be replaced with UserNotifications.frameworks API"]
        #[unsafe(method(otherButtonTitle))]
        #[unsafe(method_family = none)]
        pub fn otherButtonTitle(&self) -> Retained<NSString>;

        #[cfg(feature = "NSString")]
        /// Setter for [`otherButtonTitle`][Self::otherButtonTitle].
        ///
        /// This is [copied][crate::NSCopying::copy] when set.
        #[deprecated = "All NSUserNotifications API should be replaced with UserNotifications.frameworks API"]
        #[unsafe(method(setOtherButtonTitle:))]
        #[unsafe(method_family = none)]
        pub fn setOtherButtonTitle(&self, other_button_title: &NSString);

        #[cfg(feature = "NSString")]
        #[unsafe(method(identifier))]
        #[unsafe(method_family = none)]
        pub fn identifier(&self) -> Option<Retained<NSString>>;

        #[cfg(feature = "NSString")]
        /// Setter for [`identifier`][Self::identifier].
        ///
        /// This is [copied][crate::NSCopying::copy] when set.
        #[unsafe(method(setIdentifier:))]
        #[unsafe(method_family = none)]
        pub fn setIdentifier(&self, identifier: Option<&NSString>);

        #[unsafe(method(hasReplyButton))]
        #[unsafe(method_family = none)]
        pub fn hasReplyButton(&self) -> bool;

        /// Setter for [`hasReplyButton`][Self::hasReplyButton].
        #[unsafe(method(setHasReplyButton:))]
        #[unsafe(method_family = none)]
        pub fn setHasReplyButton(&self, has_reply_button: bool);

        #[cfg(feature = "NSString")]
        #[unsafe(method(responsePlaceholder))]
        #[unsafe(method_family = none)]
        pub fn responsePlaceholder(&self) -> Option<Retained<NSString>>;

        #[cfg(feature = "NSString")]
        /// Setter for [`responsePlaceholder`][Self::responsePlaceholder].
        ///
        /// This is [copied][crate::NSCopying::copy] when set.
        #[unsafe(method(setResponsePlaceholder:))]
        #[unsafe(method_family = none)]
        pub fn setResponsePlaceholder(&self, response_placeholder: Option<&NSString>);

        #[cfg(feature = "NSAttributedString")]
        #[unsafe(method(response))]
        #[unsafe(method_family = none)]
        pub fn response(&self) -> Option<Retained<NSAttributedString>>;

        #[cfg(feature = "NSArray")]
        #[unsafe(method(additionalActions))]
        #[unsafe(method_family = none)]
        pub fn additionalActions(&self) -> Option<Retained<NSArray<NSUserNotificationAction>>>;

        #[cfg(feature = "NSArray")]
        /// Setter for [`additionalActions`][Self::additionalActions].
        ///
        /// This is [copied][crate::NSCopying::copy] when set.
        #[unsafe(method(setAdditionalActions:))]
        #[unsafe(method_family = none)]
        pub fn setAdditionalActions(
            &self,
            additional_actions: Option<&NSArray<NSUserNotificationAction>>,
        );

        #[unsafe(method(additionalActivationAction))]
        #[unsafe(method_family = none)]
        pub fn additionalActivationAction(&self) -> Option<Retained<NSUserNotificationAction>>;
    );
}

/// Methods declared on superclass `NSObject`.
impl NSUserNotification {
    extern_methods!(
        #[unsafe(method(new))]
        #[unsafe(method_family = new)]
        pub fn new() -> Retained<Self>;
    );
}

impl DefaultRetained for NSUserNotification {
    #[inline]
    fn default_retained() -> Retained<Self> {
        Self::new()
    }
}

extern_class!(
    /// [Apple's documentation](https://developer.apple.com/documentation/foundation/nsusernotificationaction?language=objc)
    #[unsafe(super(NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    #[deprecated = "All NSUserNotifications API should be replaced with UserNotifications.frameworks API"]
    pub struct NSUserNotificationAction;
);

#[cfg(feature = "NSObject")]
extern_conformance!(
    unsafe impl NSCopying for NSUserNotificationAction {}
);

#[cfg(feature = "NSObject")]
unsafe impl CopyingHelper for NSUserNotificationAction {
    type Result = Self;
}

extern_conformance!(
    unsafe impl NSObjectProtocol for NSUserNotificationAction {}
);

impl NSUserNotificationAction {
    extern_methods!(
        #[cfg(feature = "NSString")]
        #[deprecated = "All NSUserNotifications API should be replaced with UserNotifications.frameworks API"]
        #[unsafe(method(actionWithIdentifier:title:))]
        #[unsafe(method_family = none)]
        pub fn actionWithIdentifier_title(
            identifier: Option<&NSString>,
            title: Option<&NSString>,
        ) -> Retained<Self>;

        #[cfg(feature = "NSString")]
        #[deprecated = "All NSUserNotifications API should be replaced with UserNotifications.frameworks API"]
        #[unsafe(method(identifier))]
        #[unsafe(method_family = none)]
        pub fn identifier(&self) -> Option<Retained<NSString>>;

        #[cfg(feature = "NSString")]
        #[deprecated = "All NSUserNotifications API should be replaced with UserNotifications.frameworks API"]
        #[unsafe(method(title))]
        #[unsafe(method_family = none)]
        pub fn title(&self) -> Option<Retained<NSString>>;
    );
}

/// Methods declared on superclass `NSObject`.
impl NSUserNotificationAction {
    extern_methods!(
        #[unsafe(method(init))]
        #[unsafe(method_family = init)]
        pub fn init(this: Allocated<Self>) -> Retained<Self>;

        #[unsafe(method(new))]
        #[unsafe(method_family = new)]
        pub fn new() -> Retained<Self>;
    );
}

impl DefaultRetained for NSUserNotificationAction {
    #[inline]
    fn default_retained() -> Retained<Self> {
        Self::new()
    }
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/foundation/nsusernotificationdefaultsoundname?language=objc)
    #[cfg(feature = "NSString")]
    #[deprecated = "All NSUserNotifications API should be replaced with UserNotifications.frameworks API"]
    pub static NSUserNotificationDefaultSoundName: &'static NSString;
}

extern_class!(
    /// [Apple's documentation](https://developer.apple.com/documentation/foundation/nsusernotificationcenter?language=objc)
    #[unsafe(super(NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    #[deprecated = "All NSUserNotifications API should be replaced with UserNotifications.frameworks API"]
    pub struct NSUserNotificationCenter;
);

extern_conformance!(
    unsafe impl NSObjectProtocol for NSUserNotificationCenter {}
);

impl NSUserNotificationCenter {
    extern_methods!(
        #[deprecated = "All NSUserNotifications API should be replaced with UserNotifications.frameworks API"]
        #[unsafe(method(defaultUserNotificationCenter))]
        #[unsafe(method_family = none)]
        pub fn defaultUserNotificationCenter() -> Retained<NSUserNotificationCenter>;

        /// # Safety
        ///
        /// This is not retained internally, you must ensure the object is still alive.
        #[deprecated = "All NSUserNotifications API should be replaced with UserNotifications.frameworks API"]
        #[unsafe(method(delegate))]
        #[unsafe(method_family = none)]
        pub unsafe fn delegate(
            &self,
        ) -> Option<Retained<ProtocolObject<dyn NSUserNotificationCenterDelegate>>>;

        /// Setter for [`delegate`][Self::delegate].
        ///
        /// # Safety
        ///
        /// This is unretained, you must ensure the object is kept alive while in use.
        #[deprecated = "All NSUserNotifications API should be replaced with UserNotifications.frameworks API"]
        #[unsafe(method(setDelegate:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setDelegate(
            &self,
            delegate: Option<&ProtocolObject<dyn NSUserNotificationCenterDelegate>>,
        );

        #[cfg(feature = "NSArray")]
        #[deprecated = "All NSUserNotifications API should be replaced with UserNotifications.frameworks API"]
        #[unsafe(method(scheduledNotifications))]
        #[unsafe(method_family = none)]
        pub fn scheduledNotifications(&self) -> Retained<NSArray<NSUserNotification>>;

        #[cfg(feature = "NSArray")]
        /// Setter for [`scheduledNotifications`][Self::scheduledNotifications].
        ///
        /// This is [copied][crate::NSCopying::copy] when set.
        #[deprecated = "All NSUserNotifications API should be replaced with UserNotifications.frameworks API"]
        #[unsafe(method(setScheduledNotifications:))]
        #[unsafe(method_family = none)]
        pub fn setScheduledNotifications(
            &self,
            scheduled_notifications: &NSArray<NSUserNotification>,
        );

        #[deprecated = "All NSUserNotifications API should be replaced with UserNotifications.frameworks API"]
        #[unsafe(method(scheduleNotification:))]
        #[unsafe(method_family = none)]
        pub fn scheduleNotification(&self, notification: &NSUserNotification);

        #[deprecated = "All NSUserNotifications API should be replaced with UserNotifications.frameworks API"]
        #[unsafe(method(removeScheduledNotification:))]
        #[unsafe(method_family = none)]
        pub fn removeScheduledNotification(&self, notification: &NSUserNotification);

        #[cfg(feature = "NSArray")]
        #[deprecated = "All NSUserNotifications API should be replaced with UserNotifications.frameworks API"]
        #[unsafe(method(deliveredNotifications))]
        #[unsafe(method_family = none)]
        pub fn deliveredNotifications(&self) -> Retained<NSArray<NSUserNotification>>;

        #[deprecated = "All NSUserNotifications API should be replaced with UserNotifications.frameworks API"]
        #[unsafe(method(deliverNotification:))]
        #[unsafe(method_family = none)]
        pub fn deliverNotification(&self, notification: &NSUserNotification);

        #[deprecated = "All NSUserNotifications API should be replaced with UserNotifications.frameworks API"]
        #[unsafe(method(removeDeliveredNotification:))]
        #[unsafe(method_family = none)]
        pub fn removeDeliveredNotification(&self, notification: &NSUserNotification);

        #[deprecated = "All NSUserNotifications API should be replaced with UserNotifications.frameworks API"]
        #[unsafe(method(removeAllDeliveredNotifications))]
        #[unsafe(method_family = none)]
        pub fn removeAllDeliveredNotifications(&self);
    );
}

/// Methods declared on superclass `NSObject`.
impl NSUserNotificationCenter {
    extern_methods!(
        #[unsafe(method(init))]
        #[unsafe(method_family = init)]
        pub fn init(this: Allocated<Self>) -> Retained<Self>;

        #[unsafe(method(new))]
        #[unsafe(method_family = new)]
        pub fn new() -> Retained<Self>;
    );
}

impl DefaultRetained for NSUserNotificationCenter {
    #[inline]
    fn default_retained() -> Retained<Self> {
        Self::new()
    }
}

extern_protocol!(
    /// [Apple's documentation](https://developer.apple.com/documentation/foundation/nsusernotificationcenterdelegate?language=objc)
    pub unsafe trait NSUserNotificationCenterDelegate: NSObjectProtocol {
        #[deprecated = "All NSUserNotifications API should be replaced with UserNotifications.frameworks API"]
        #[optional]
        #[unsafe(method(userNotificationCenter:didDeliverNotification:))]
        #[unsafe(method_family = none)]
        fn userNotificationCenter_didDeliverNotification(
            &self,
            center: &NSUserNotificationCenter,
            notification: &NSUserNotification,
        );

        #[deprecated = "All NSUserNotifications API should be replaced with UserNotifications.frameworks API"]
        #[optional]
        #[unsafe(method(userNotificationCenter:didActivateNotification:))]
        #[unsafe(method_family = none)]
        fn userNotificationCenter_didActivateNotification(
            &self,
            center: &NSUserNotificationCenter,
            notification: &NSUserNotification,
        );

        #[deprecated = "All NSUserNotifications API should be replaced with UserNotifications.frameworks API"]
        #[optional]
        #[unsafe(method(userNotificationCenter:shouldPresentNotification:))]
        #[unsafe(method_family = none)]
        fn userNotificationCenter_shouldPresentNotification(
            &self,
            center: &NSUserNotificationCenter,
            notification: &NSUserNotification,
        ) -> bool;
    }
);