icrate 0.1.2

Bindings to Apple's frameworks
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
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
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use crate::common::*;
use crate::AppKit::*;
use crate::Foundation::*;
use crate::GameKit::*;

ns_enum!(
    #[underlying(NSInteger)]
    pub enum GKTurnBasedMatchStatus {
        GKTurnBasedMatchStatusUnknown = 0,
        GKTurnBasedMatchStatusOpen = 1,
        GKTurnBasedMatchStatusEnded = 2,
        GKTurnBasedMatchStatusMatching = 3,
    }
);

ns_enum!(
    #[underlying(NSInteger)]
    pub enum GKTurnBasedParticipantStatus {
        GKTurnBasedParticipantStatusUnknown = 0,
        GKTurnBasedParticipantStatusInvited = 1,
        GKTurnBasedParticipantStatusDeclined = 2,
        GKTurnBasedParticipantStatusMatching = 3,
        GKTurnBasedParticipantStatusActive = 4,
        GKTurnBasedParticipantStatusDone = 5,
    }
);

ns_enum!(
    #[underlying(NSInteger)]
    pub enum GKTurnBasedMatchOutcome {
        GKTurnBasedMatchOutcomeNone = 0,
        GKTurnBasedMatchOutcomeQuit = 1,
        GKTurnBasedMatchOutcomeWon = 2,
        GKTurnBasedMatchOutcomeLost = 3,
        GKTurnBasedMatchOutcomeTied = 4,
        GKTurnBasedMatchOutcomeTimeExpired = 5,
        GKTurnBasedMatchOutcomeFirst = 6,
        GKTurnBasedMatchOutcomeSecond = 7,
        GKTurnBasedMatchOutcomeThird = 8,
        GKTurnBasedMatchOutcomeFourth = 9,
        GKTurnBasedMatchOutcomeCustomRange = 0x00FF0000,
    }
);

extern_class!(
    #[derive(Debug, PartialEq, Eq, Hash)]
    #[cfg(feature = "GameKit_GKTurnBasedParticipant")]
    pub struct GKTurnBasedParticipant;

    #[cfg(feature = "GameKit_GKTurnBasedParticipant")]
    unsafe impl ClassType for GKTurnBasedParticipant {
        type Super = NSObject;
        type Mutability = InteriorMutable;
    }
);

#[cfg(feature = "GameKit_GKTurnBasedParticipant")]
unsafe impl NSObjectProtocol for GKTurnBasedParticipant {}

extern_methods!(
    #[cfg(feature = "GameKit_GKTurnBasedParticipant")]
    unsafe impl GKTurnBasedParticipant {
        #[cfg(feature = "GameKit_GKPlayer")]
        #[method_id(@__retain_semantics Other player)]
        pub unsafe fn player(&self) -> Option<Id<GKPlayer>>;

        #[cfg(feature = "Foundation_NSDate")]
        #[method_id(@__retain_semantics Other lastTurnDate)]
        pub unsafe fn lastTurnDate(&self) -> Option<Id<NSDate>>;

        #[method(status)]
        pub unsafe fn status(&self) -> GKTurnBasedParticipantStatus;

        #[method(matchOutcome)]
        pub unsafe fn matchOutcome(&self) -> GKTurnBasedMatchOutcome;

        #[method(setMatchOutcome:)]
        pub unsafe fn setMatchOutcome(&self, match_outcome: GKTurnBasedMatchOutcome);

        #[cfg(feature = "Foundation_NSDate")]
        #[method_id(@__retain_semantics Other timeoutDate)]
        pub unsafe fn timeoutDate(&self) -> Option<Id<NSDate>>;
    }
);

extern_methods!(
    /// Methods declared on superclass `NSObject`
    #[cfg(feature = "GameKit_GKTurnBasedParticipant")]
    unsafe impl GKTurnBasedParticipant {
        #[method_id(@__retain_semantics Init init)]
        pub unsafe fn init(this: Allocated<Self>) -> Id<Self>;

        #[method_id(@__retain_semantics New new)]
        pub unsafe fn new() -> Id<Self>;
    }
);

extern_methods!(
    /// Obsoleted
    #[cfg(feature = "GameKit_GKTurnBasedParticipant")]
    unsafe impl GKTurnBasedParticipant {
        #[cfg(feature = "Foundation_NSString")]
        #[deprecated]
        #[method_id(@__retain_semantics Other playerID)]
        pub unsafe fn playerID(&self) -> Option<Id<NSString>>;
    }
);

extern_protocol!(
    pub unsafe trait GKTurnBasedEventListener {
        #[cfg(all(feature = "Foundation_NSArray", feature = "GameKit_GKPlayer"))]
        #[optional]
        #[method(player:didRequestMatchWithOtherPlayers:)]
        unsafe fn player_didRequestMatchWithOtherPlayers(
            &self,
            player: &GKPlayer,
            players_to_invite: &NSArray<GKPlayer>,
        );

        #[cfg(all(feature = "GameKit_GKPlayer", feature = "GameKit_GKTurnBasedMatch"))]
        #[optional]
        #[method(player:receivedTurnEventForMatch:didBecomeActive:)]
        unsafe fn player_receivedTurnEventForMatch_didBecomeActive(
            &self,
            player: &GKPlayer,
            r#match: &GKTurnBasedMatch,
            did_become_active: bool,
        );

        #[cfg(all(feature = "GameKit_GKPlayer", feature = "GameKit_GKTurnBasedMatch"))]
        #[optional]
        #[method(player:matchEnded:)]
        unsafe fn player_matchEnded(&self, player: &GKPlayer, r#match: &GKTurnBasedMatch);

        #[cfg(all(
            feature = "GameKit_GKPlayer",
            feature = "GameKit_GKTurnBasedExchange",
            feature = "GameKit_GKTurnBasedMatch"
        ))]
        #[optional]
        #[method(player:receivedExchangeRequest:forMatch:)]
        unsafe fn player_receivedExchangeRequest_forMatch(
            &self,
            player: &GKPlayer,
            exchange: &GKTurnBasedExchange,
            r#match: &GKTurnBasedMatch,
        );

        #[cfg(all(
            feature = "GameKit_GKPlayer",
            feature = "GameKit_GKTurnBasedExchange",
            feature = "GameKit_GKTurnBasedMatch"
        ))]
        #[optional]
        #[method(player:receivedExchangeCancellation:forMatch:)]
        unsafe fn player_receivedExchangeCancellation_forMatch(
            &self,
            player: &GKPlayer,
            exchange: &GKTurnBasedExchange,
            r#match: &GKTurnBasedMatch,
        );

        #[cfg(all(
            feature = "Foundation_NSArray",
            feature = "GameKit_GKPlayer",
            feature = "GameKit_GKTurnBasedExchange",
            feature = "GameKit_GKTurnBasedExchangeReply",
            feature = "GameKit_GKTurnBasedMatch"
        ))]
        #[optional]
        #[method(player:receivedExchangeReplies:forCompletedExchange:forMatch:)]
        unsafe fn player_receivedExchangeReplies_forCompletedExchange_forMatch(
            &self,
            player: &GKPlayer,
            replies: &NSArray<GKTurnBasedExchangeReply>,
            exchange: &GKTurnBasedExchange,
            r#match: &GKTurnBasedMatch,
        );

        #[cfg(all(feature = "GameKit_GKPlayer", feature = "GameKit_GKTurnBasedMatch"))]
        #[optional]
        #[method(player:wantsToQuitMatch:)]
        unsafe fn player_wantsToQuitMatch(&self, player: &GKPlayer, r#match: &GKTurnBasedMatch);

        #[cfg(all(
            feature = "Foundation_NSArray",
            feature = "Foundation_NSString",
            feature = "GameKit_GKPlayer"
        ))]
        #[deprecated]
        #[optional]
        #[method(player:didRequestMatchWithPlayers:)]
        unsafe fn player_didRequestMatchWithPlayers(
            &self,
            player: &GKPlayer,
            player_i_ds_to_invite: &NSArray<NSString>,
        );
    }

    unsafe impl ProtocolType for dyn GKTurnBasedEventListener {}
);

extern_static!(GKTurnTimeoutDefault: NSTimeInterval);

extern_static!(GKTurnTimeoutNone: NSTimeInterval);

extern_class!(
    #[derive(Debug, PartialEq, Eq, Hash)]
    #[cfg(feature = "GameKit_GKTurnBasedMatch")]
    pub struct GKTurnBasedMatch;

    #[cfg(feature = "GameKit_GKTurnBasedMatch")]
    unsafe impl ClassType for GKTurnBasedMatch {
        type Super = NSObject;
        type Mutability = InteriorMutable;
    }
);

#[cfg(feature = "GameKit_GKTurnBasedMatch")]
unsafe impl NSObjectProtocol for GKTurnBasedMatch {}

extern_methods!(
    #[cfg(feature = "GameKit_GKTurnBasedMatch")]
    unsafe impl GKTurnBasedMatch {
        #[cfg(feature = "Foundation_NSString")]
        #[method_id(@__retain_semantics Other matchID)]
        pub unsafe fn matchID(&self) -> Option<Id<NSString>>;

        #[cfg(feature = "Foundation_NSDate")]
        #[method_id(@__retain_semantics Other creationDate)]
        pub unsafe fn creationDate(&self) -> Option<Id<NSDate>>;

        #[cfg(all(
            feature = "Foundation_NSArray",
            feature = "GameKit_GKTurnBasedParticipant"
        ))]
        #[method_id(@__retain_semantics Other participants)]
        pub unsafe fn participants(&self) -> Option<Id<NSArray<GKTurnBasedParticipant>>>;

        #[method(status)]
        pub unsafe fn status(&self) -> GKTurnBasedMatchStatus;

        #[cfg(feature = "GameKit_GKTurnBasedParticipant")]
        #[method_id(@__retain_semantics Other currentParticipant)]
        pub unsafe fn currentParticipant(&self) -> Option<Id<GKTurnBasedParticipant>>;

        #[cfg(feature = "Foundation_NSData")]
        #[method_id(@__retain_semantics Other matchData)]
        pub unsafe fn matchData(&self) -> Option<Id<NSData>>;

        #[cfg(all(feature = "Foundation_NSArray", feature = "Foundation_NSString"))]
        #[method(setLocalizableMessageWithKey:arguments:)]
        pub unsafe fn setLocalizableMessageWithKey_arguments(
            &self,
            key: &NSString,
            arguments: Option<&NSArray<NSString>>,
        );

        #[cfg(feature = "Foundation_NSString")]
        #[method_id(@__retain_semantics Other message)]
        pub unsafe fn message(&self) -> Option<Id<NSString>>;

        #[cfg(feature = "Foundation_NSString")]
        #[method(setMessage:)]
        pub unsafe fn setMessage(&self, message: Option<&NSString>);

        #[method(matchDataMaximumSize)]
        pub unsafe fn matchDataMaximumSize(&self) -> NSUInteger;

        #[cfg(all(
            feature = "Foundation_NSArray",
            feature = "GameKit_GKTurnBasedExchange"
        ))]
        #[method_id(@__retain_semantics Other exchanges)]
        pub unsafe fn exchanges(&self) -> Option<Id<NSArray<GKTurnBasedExchange>>>;

        #[cfg(all(
            feature = "Foundation_NSArray",
            feature = "GameKit_GKTurnBasedExchange"
        ))]
        #[method_id(@__retain_semantics Other activeExchanges)]
        pub unsafe fn activeExchanges(&self) -> Option<Id<NSArray<GKTurnBasedExchange>>>;

        #[cfg(all(
            feature = "Foundation_NSArray",
            feature = "GameKit_GKTurnBasedExchange"
        ))]
        #[method_id(@__retain_semantics Other completedExchanges)]
        pub unsafe fn completedExchanges(&self) -> Option<Id<NSArray<GKTurnBasedExchange>>>;

        #[method(exchangeDataMaximumSize)]
        pub unsafe fn exchangeDataMaximumSize(&self) -> NSUInteger;

        #[method(exchangeMaxInitiatedExchangesPerPlayer)]
        pub unsafe fn exchangeMaxInitiatedExchangesPerPlayer(&self) -> NSUInteger;

        #[cfg(all(feature = "Foundation_NSError", feature = "GameKit_GKMatchRequest"))]
        #[method(findMatchForRequest:withCompletionHandler:)]
        pub unsafe fn findMatchForRequest_withCompletionHandler(
            request: &GKMatchRequest,
            completion_handler: &Block<(*mut GKTurnBasedMatch, *mut NSError), ()>,
        );

        #[cfg(all(feature = "Foundation_NSArray", feature = "Foundation_NSError"))]
        #[method(loadMatchesWithCompletionHandler:)]
        pub unsafe fn loadMatchesWithCompletionHandler(
            completion_handler: Option<&Block<(*mut NSArray<GKTurnBasedMatch>, *mut NSError), ()>>,
        );

        #[cfg(all(feature = "Foundation_NSError", feature = "Foundation_NSString"))]
        #[method(loadMatchWithID:withCompletionHandler:)]
        pub unsafe fn loadMatchWithID_withCompletionHandler(
            match_id: &NSString,
            completion_handler: Option<&Block<(*mut GKTurnBasedMatch, *mut NSError), ()>>,
        );

        #[cfg(feature = "Foundation_NSError")]
        #[method(rematchWithCompletionHandler:)]
        pub unsafe fn rematchWithCompletionHandler(
            &self,
            completion_handler: Option<&Block<(*mut GKTurnBasedMatch, *mut NSError), ()>>,
        );

        #[cfg(feature = "Foundation_NSError")]
        #[method(acceptInviteWithCompletionHandler:)]
        pub unsafe fn acceptInviteWithCompletionHandler(
            &self,
            completion_handler: Option<&Block<(*mut GKTurnBasedMatch, *mut NSError), ()>>,
        );

        #[cfg(feature = "Foundation_NSError")]
        #[method(declineInviteWithCompletionHandler:)]
        pub unsafe fn declineInviteWithCompletionHandler(
            &self,
            completion_handler: Option<&Block<(*mut NSError,), ()>>,
        );

        #[cfg(feature = "Foundation_NSError")]
        #[method(removeWithCompletionHandler:)]
        pub unsafe fn removeWithCompletionHandler(
            &self,
            completion_handler: Option<&Block<(*mut NSError,), ()>>,
        );

        #[cfg(all(feature = "Foundation_NSData", feature = "Foundation_NSError"))]
        #[method(loadMatchDataWithCompletionHandler:)]
        pub unsafe fn loadMatchDataWithCompletionHandler(
            &self,
            completion_handler: Option<&Block<(*mut NSData, *mut NSError), ()>>,
        );

        #[cfg(all(
            feature = "Foundation_NSArray",
            feature = "Foundation_NSData",
            feature = "Foundation_NSError",
            feature = "GameKit_GKTurnBasedParticipant"
        ))]
        #[method(endTurnWithNextParticipants:turnTimeout:matchData:completionHandler:)]
        pub unsafe fn endTurnWithNextParticipants_turnTimeout_matchData_completionHandler(
            &self,
            next_participants: &NSArray<GKTurnBasedParticipant>,
            timeout: NSTimeInterval,
            match_data: &NSData,
            completion_handler: Option<&Block<(*mut NSError,), ()>>,
        );

        #[cfg(all(
            feature = "Foundation_NSArray",
            feature = "Foundation_NSData",
            feature = "Foundation_NSError",
            feature = "GameKit_GKTurnBasedParticipant"
        ))]
        #[method(participantQuitInTurnWithOutcome:nextParticipants:turnTimeout:matchData:completionHandler:)]
        pub unsafe fn participantQuitInTurnWithOutcome_nextParticipants_turnTimeout_matchData_completionHandler(
            &self,
            match_outcome: GKTurnBasedMatchOutcome,
            next_participants: &NSArray<GKTurnBasedParticipant>,
            timeout: NSTimeInterval,
            match_data: &NSData,
            completion_handler: Option<&Block<(*mut NSError,), ()>>,
        );

        #[cfg(feature = "Foundation_NSError")]
        #[method(participantQuitOutOfTurnWithOutcome:withCompletionHandler:)]
        pub unsafe fn participantQuitOutOfTurnWithOutcome_withCompletionHandler(
            &self,
            match_outcome: GKTurnBasedMatchOutcome,
            completion_handler: Option<&Block<(*mut NSError,), ()>>,
        );

        #[cfg(all(feature = "Foundation_NSData", feature = "Foundation_NSError"))]
        #[method(endMatchInTurnWithMatchData:completionHandler:)]
        pub unsafe fn endMatchInTurnWithMatchData_completionHandler(
            &self,
            match_data: &NSData,
            completion_handler: Option<&Block<(*mut NSError,), ()>>,
        );

        #[cfg(all(
            feature = "Foundation_NSArray",
            feature = "Foundation_NSData",
            feature = "Foundation_NSError",
            feature = "GameKit_GKAchievement",
            feature = "GameKit_GKScore"
        ))]
        #[deprecated]
        #[method(endMatchInTurnWithMatchData:scores:achievements:completionHandler:)]
        pub unsafe fn endMatchInTurnWithMatchData_scores_achievements_completionHandler(
            &self,
            match_data: &NSData,
            scores: Option<&NSArray<GKScore>>,
            achievements: Option<&NSArray<GKAchievement>>,
            completion_handler: Option<&Block<(*mut NSError,), ()>>,
        );

        #[cfg(all(
            feature = "Foundation_NSArray",
            feature = "Foundation_NSData",
            feature = "Foundation_NSError",
            feature = "GameKit_GKLeaderboardScore"
        ))]
        #[method(endMatchInTurnWithMatchData:leaderboardScores:achievements:completionHandler:)]
        pub unsafe fn endMatchInTurnWithMatchData_leaderboardScores_achievements_completionHandler(
            &self,
            match_data: &NSData,
            scores: &NSArray<GKLeaderboardScore>,
            achievements: &NSArray,
            completion_handler: &Block<(*mut NSError,), ()>,
        );

        #[cfg(all(feature = "Foundation_NSData", feature = "Foundation_NSError"))]
        #[method(saveCurrentTurnWithMatchData:completionHandler:)]
        pub unsafe fn saveCurrentTurnWithMatchData_completionHandler(
            &self,
            match_data: &NSData,
            completion_handler: Option<&Block<(*mut NSError,), ()>>,
        );

        #[cfg(all(
            feature = "Foundation_NSArray",
            feature = "Foundation_NSData",
            feature = "Foundation_NSError",
            feature = "GameKit_GKTurnBasedExchange"
        ))]
        #[method(saveMergedMatchData:withResolvedExchanges:completionHandler:)]
        pub unsafe fn saveMergedMatchData_withResolvedExchanges_completionHandler(
            &self,
            match_data: &NSData,
            exchanges: &NSArray<GKTurnBasedExchange>,
            completion_handler: Option<&Block<(*mut NSError,), ()>>,
        );

        #[cfg(all(
            feature = "Foundation_NSArray",
            feature = "Foundation_NSData",
            feature = "Foundation_NSError",
            feature = "Foundation_NSString",
            feature = "GameKit_GKTurnBasedExchange",
            feature = "GameKit_GKTurnBasedParticipant"
        ))]
        #[method(sendExchangeToParticipants:data:localizableMessageKey:arguments:timeout:completionHandler:)]
        pub unsafe fn sendExchangeToParticipants_data_localizableMessageKey_arguments_timeout_completionHandler(
            &self,
            participants: &NSArray<GKTurnBasedParticipant>,
            data: &NSData,
            key: &NSString,
            arguments: &NSArray<NSString>,
            timeout: NSTimeInterval,
            completion_handler: Option<&Block<(*mut GKTurnBasedExchange, *mut NSError), ()>>,
        );

        #[cfg(all(
            feature = "Foundation_NSArray",
            feature = "Foundation_NSError",
            feature = "Foundation_NSString",
            feature = "GameKit_GKTurnBasedParticipant"
        ))]
        #[method(sendReminderToParticipants:localizableMessageKey:arguments:completionHandler:)]
        pub unsafe fn sendReminderToParticipants_localizableMessageKey_arguments_completionHandler(
            &self,
            participants: &NSArray<GKTurnBasedParticipant>,
            key: &NSString,
            arguments: &NSArray<NSString>,
            completion_handler: Option<&Block<(*mut NSError,), ()>>,
        );

        #[cfg(all(
            feature = "Foundation_NSData",
            feature = "Foundation_NSError",
            feature = "GameKit_GKTurnBasedParticipant"
        ))]
        #[deprecated]
        #[method(endTurnWithNextParticipant:matchData:completionHandler:)]
        pub unsafe fn endTurnWithNextParticipant_matchData_completionHandler(
            &self,
            next_participant: &GKTurnBasedParticipant,
            match_data: &NSData,
            completion_handler: Option<&Block<(*mut NSError,), ()>>,
        );

        #[cfg(all(
            feature = "Foundation_NSData",
            feature = "Foundation_NSError",
            feature = "GameKit_GKTurnBasedParticipant"
        ))]
        #[deprecated]
        #[method(participantQuitInTurnWithOutcome:nextParticipant:matchData:completionHandler:)]
        pub unsafe fn participantQuitInTurnWithOutcome_nextParticipant_matchData_completionHandler(
            &self,
            match_outcome: GKTurnBasedMatchOutcome,
            next_participant: &GKTurnBasedParticipant,
            match_data: &NSData,
            completion_handler: Option<&Block<(*mut NSError,), ()>>,
        );
    }
);

extern_methods!(
    /// Methods declared on superclass `NSObject`
    #[cfg(feature = "GameKit_GKTurnBasedMatch")]
    unsafe impl GKTurnBasedMatch {
        #[method_id(@__retain_semantics Init init)]
        pub unsafe fn init(this: Allocated<Self>) -> Id<Self>;

        #[method_id(@__retain_semantics New new)]
        pub unsafe fn new() -> Id<Self>;
    }
);

ns_enum!(
    #[underlying(i8)]
    pub enum GKTurnBasedExchangeStatus {
        GKTurnBasedExchangeStatusUnknown = 0,
        GKTurnBasedExchangeStatusActive = 1,
        GKTurnBasedExchangeStatusComplete = 2,
        GKTurnBasedExchangeStatusResolved = 3,
        GKTurnBasedExchangeStatusCanceled = 4,
    }
);

extern_static!(GKExchangeTimeoutDefault: NSTimeInterval);

extern_static!(GKExchangeTimeoutNone: NSTimeInterval);

extern_class!(
    #[derive(Debug, PartialEq, Eq, Hash)]
    #[cfg(feature = "GameKit_GKTurnBasedExchange")]
    pub struct GKTurnBasedExchange;

    #[cfg(feature = "GameKit_GKTurnBasedExchange")]
    unsafe impl ClassType for GKTurnBasedExchange {
        type Super = NSObject;
        type Mutability = InteriorMutable;
    }
);

#[cfg(feature = "GameKit_GKTurnBasedExchange")]
unsafe impl NSObjectProtocol for GKTurnBasedExchange {}

extern_methods!(
    #[cfg(feature = "GameKit_GKTurnBasedExchange")]
    unsafe impl GKTurnBasedExchange {
        #[cfg(feature = "Foundation_NSString")]
        #[method_id(@__retain_semantics Other exchangeID)]
        pub unsafe fn exchangeID(&self) -> Option<Id<NSString>>;

        #[cfg(feature = "GameKit_GKTurnBasedParticipant")]
        #[method_id(@__retain_semantics Other sender)]
        pub unsafe fn sender(&self) -> Option<Id<GKTurnBasedParticipant>>;

        #[cfg(all(
            feature = "Foundation_NSArray",
            feature = "GameKit_GKTurnBasedParticipant"
        ))]
        #[method_id(@__retain_semantics Other recipients)]
        pub unsafe fn recipients(&self) -> Option<Id<NSArray<GKTurnBasedParticipant>>>;

        #[method(status)]
        pub unsafe fn status(&self) -> GKTurnBasedExchangeStatus;

        #[cfg(feature = "Foundation_NSString")]
        #[method_id(@__retain_semantics Other message)]
        pub unsafe fn message(&self) -> Option<Id<NSString>>;

        #[cfg(feature = "Foundation_NSData")]
        #[method_id(@__retain_semantics Other data)]
        pub unsafe fn data(&self) -> Option<Id<NSData>>;

        #[cfg(feature = "Foundation_NSDate")]
        #[method_id(@__retain_semantics Other sendDate)]
        pub unsafe fn sendDate(&self) -> Option<Id<NSDate>>;

        #[cfg(feature = "Foundation_NSDate")]
        #[method_id(@__retain_semantics Other timeoutDate)]
        pub unsafe fn timeoutDate(&self) -> Option<Id<NSDate>>;

        #[cfg(feature = "Foundation_NSDate")]
        #[method_id(@__retain_semantics Other completionDate)]
        pub unsafe fn completionDate(&self) -> Option<Id<NSDate>>;

        #[cfg(all(
            feature = "Foundation_NSArray",
            feature = "GameKit_GKTurnBasedExchangeReply"
        ))]
        #[method_id(@__retain_semantics Other replies)]
        pub unsafe fn replies(&self) -> Option<Id<NSArray<GKTurnBasedExchangeReply>>>;

        #[cfg(all(
            feature = "Foundation_NSArray",
            feature = "Foundation_NSError",
            feature = "Foundation_NSString"
        ))]
        #[method(cancelWithLocalizableMessageKey:arguments:completionHandler:)]
        pub unsafe fn cancelWithLocalizableMessageKey_arguments_completionHandler(
            &self,
            key: &NSString,
            arguments: &NSArray<NSString>,
            completion_handler: Option<&Block<(*mut NSError,), ()>>,
        );

        #[cfg(all(
            feature = "Foundation_NSArray",
            feature = "Foundation_NSData",
            feature = "Foundation_NSError",
            feature = "Foundation_NSString"
        ))]
        #[method(replyWithLocalizableMessageKey:arguments:data:completionHandler:)]
        pub unsafe fn replyWithLocalizableMessageKey_arguments_data_completionHandler(
            &self,
            key: &NSString,
            arguments: &NSArray<NSString>,
            data: &NSData,
            completion_handler: Option<&Block<(*mut NSError,), ()>>,
        );
    }
);

extern_methods!(
    /// Methods declared on superclass `NSObject`
    #[cfg(feature = "GameKit_GKTurnBasedExchange")]
    unsafe impl GKTurnBasedExchange {
        #[method_id(@__retain_semantics Init init)]
        pub unsafe fn init(this: Allocated<Self>) -> Id<Self>;

        #[method_id(@__retain_semantics New new)]
        pub unsafe fn new() -> Id<Self>;
    }
);

extern_class!(
    #[derive(Debug, PartialEq, Eq, Hash)]
    #[cfg(feature = "GameKit_GKTurnBasedExchangeReply")]
    pub struct GKTurnBasedExchangeReply;

    #[cfg(feature = "GameKit_GKTurnBasedExchangeReply")]
    unsafe impl ClassType for GKTurnBasedExchangeReply {
        type Super = NSObject;
        type Mutability = InteriorMutable;
    }
);

#[cfg(feature = "GameKit_GKTurnBasedExchangeReply")]
unsafe impl NSObjectProtocol for GKTurnBasedExchangeReply {}

extern_methods!(
    #[cfg(feature = "GameKit_GKTurnBasedExchangeReply")]
    unsafe impl GKTurnBasedExchangeReply {
        #[cfg(feature = "GameKit_GKTurnBasedParticipant")]
        #[method_id(@__retain_semantics Other recipient)]
        pub unsafe fn recipient(&self) -> Option<Id<GKTurnBasedParticipant>>;

        #[cfg(feature = "Foundation_NSString")]
        #[method_id(@__retain_semantics Other message)]
        pub unsafe fn message(&self) -> Option<Id<NSString>>;

        #[cfg(feature = "Foundation_NSData")]
        #[method_id(@__retain_semantics Other data)]
        pub unsafe fn data(&self) -> Option<Id<NSData>>;

        #[cfg(feature = "Foundation_NSDate")]
        #[method_id(@__retain_semantics Other replyDate)]
        pub unsafe fn replyDate(&self) -> Option<Id<NSDate>>;
    }
);

extern_methods!(
    /// Methods declared on superclass `NSObject`
    #[cfg(feature = "GameKit_GKTurnBasedExchangeReply")]
    unsafe impl GKTurnBasedExchangeReply {
        #[method_id(@__retain_semantics Init init)]
        pub unsafe fn init(this: Allocated<Self>) -> Id<Self>;

        #[method_id(@__retain_semantics New new)]
        pub unsafe fn new() -> Id<Self>;
    }
);

extern_protocol!(
    #[deprecated]
    pub unsafe trait GKTurnBasedEventHandlerDelegate {
        #[cfg(all(feature = "Foundation_NSArray", feature = "Foundation_NSString"))]
        #[deprecated]
        #[method(handleInviteFromGameCenter:)]
        unsafe fn handleInviteFromGameCenter(&self, players_to_invite: &NSArray<NSString>);

        #[cfg(feature = "GameKit_GKTurnBasedMatch")]
        #[deprecated]
        #[method(handleTurnEventForMatch:didBecomeActive:)]
        unsafe fn handleTurnEventForMatch_didBecomeActive(
            &self,
            r#match: &GKTurnBasedMatch,
            did_become_active: bool,
        );

        #[cfg(feature = "GameKit_GKTurnBasedMatch")]
        #[deprecated]
        #[optional]
        #[method(handleTurnEventForMatch:)]
        unsafe fn handleTurnEventForMatch(&self, r#match: &GKTurnBasedMatch);

        #[cfg(feature = "GameKit_GKTurnBasedMatch")]
        #[deprecated]
        #[optional]
        #[method(handleMatchEnded:)]
        unsafe fn handleMatchEnded(&self, r#match: &GKTurnBasedMatch);
    }

    unsafe impl ProtocolType for dyn GKTurnBasedEventHandlerDelegate {}
);

extern_class!(
    #[derive(Debug, PartialEq, Eq, Hash)]
    #[cfg(feature = "GameKit_GKTurnBasedEventHandler")]
    #[deprecated]
    pub struct GKTurnBasedEventHandler;

    #[cfg(feature = "GameKit_GKTurnBasedEventHandler")]
    unsafe impl ClassType for GKTurnBasedEventHandler {
        type Super = NSObject;
        type Mutability = InteriorMutable;
    }
);

#[cfg(feature = "GameKit_GKTurnBasedEventHandler")]
unsafe impl NSObjectProtocol for GKTurnBasedEventHandler {}

extern_methods!(
    #[cfg(feature = "GameKit_GKTurnBasedEventHandler")]
    unsafe impl GKTurnBasedEventHandler {
        #[deprecated]
        #[method_id(@__retain_semantics Other sharedTurnBasedEventHandler)]
        pub unsafe fn sharedTurnBasedEventHandler() -> Id<GKTurnBasedEventHandler>;

        #[deprecated]
        #[method_id(@__retain_semantics Other delegate)]
        pub unsafe fn delegate(&self) -> Option<Id<NSObject>>;

        #[deprecated]
        #[method(setDelegate:)]
        pub unsafe fn setDelegate(&self, delegate: Option<&NSObject>);
    }
);

extern_methods!(
    /// Methods declared on superclass `NSObject`
    #[cfg(feature = "GameKit_GKTurnBasedEventHandler")]
    unsafe impl GKTurnBasedEventHandler {
        #[method_id(@__retain_semantics Init init)]
        pub unsafe fn init(this: Allocated<Self>) -> Id<Self>;

        #[method_id(@__retain_semantics New new)]
        pub unsafe fn new() -> Id<Self>;
    }
);