1use core::ffi::*;
4use core::ptr::NonNull;
5use objc2::__framework_prelude::*;
6use objc2_foundation::*;
7
8use crate::*;
9
10#[repr(transparent)]
15#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
16pub struct GKTurnBasedMatchStatus(pub NSInteger);
17impl GKTurnBasedMatchStatus {
18 #[doc(alias = "GKTurnBasedMatchStatusUnknown")]
19 pub const Unknown: Self = Self(0);
20 #[doc(alias = "GKTurnBasedMatchStatusOpen")]
21 pub const Open: Self = Self(1);
22 #[doc(alias = "GKTurnBasedMatchStatusEnded")]
23 pub const Ended: Self = Self(2);
24 #[doc(alias = "GKTurnBasedMatchStatusMatching")]
25 pub const Matching: Self = Self(3);
26}
27
28unsafe impl Encode for GKTurnBasedMatchStatus {
29 const ENCODING: Encoding = NSInteger::ENCODING;
30}
31
32unsafe impl RefEncode for GKTurnBasedMatchStatus {
33 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
34}
35
36#[repr(transparent)]
41#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
42pub struct GKTurnBasedParticipantStatus(pub NSInteger);
43impl GKTurnBasedParticipantStatus {
44 #[doc(alias = "GKTurnBasedParticipantStatusUnknown")]
45 pub const Unknown: Self = Self(0);
46 #[doc(alias = "GKTurnBasedParticipantStatusInvited")]
47 pub const Invited: Self = Self(1);
48 #[doc(alias = "GKTurnBasedParticipantStatusDeclined")]
49 pub const Declined: Self = Self(2);
50 #[doc(alias = "GKTurnBasedParticipantStatusMatching")]
51 pub const Matching: Self = Self(3);
52 #[doc(alias = "GKTurnBasedParticipantStatusActive")]
53 pub const Active: Self = Self(4);
54 #[doc(alias = "GKTurnBasedParticipantStatusDone")]
55 pub const Done: Self = Self(5);
56}
57
58unsafe impl Encode for GKTurnBasedParticipantStatus {
59 const ENCODING: Encoding = NSInteger::ENCODING;
60}
61
62unsafe impl RefEncode for GKTurnBasedParticipantStatus {
63 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
64}
65
66#[repr(transparent)]
71#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
72pub struct GKTurnBasedMatchOutcome(pub NSInteger);
73impl GKTurnBasedMatchOutcome {
74 #[doc(alias = "GKTurnBasedMatchOutcomeNone")]
75 pub const None: Self = Self(0);
76 #[doc(alias = "GKTurnBasedMatchOutcomeQuit")]
77 pub const Quit: Self = Self(1);
78 #[doc(alias = "GKTurnBasedMatchOutcomeWon")]
79 pub const Won: Self = Self(2);
80 #[doc(alias = "GKTurnBasedMatchOutcomeLost")]
81 pub const Lost: Self = Self(3);
82 #[doc(alias = "GKTurnBasedMatchOutcomeTied")]
83 pub const Tied: Self = Self(4);
84 #[doc(alias = "GKTurnBasedMatchOutcomeTimeExpired")]
85 pub const TimeExpired: Self = Self(5);
86 #[doc(alias = "GKTurnBasedMatchOutcomeFirst")]
87 pub const First: Self = Self(6);
88 #[doc(alias = "GKTurnBasedMatchOutcomeSecond")]
89 pub const Second: Self = Self(7);
90 #[doc(alias = "GKTurnBasedMatchOutcomeThird")]
91 pub const Third: Self = Self(8);
92 #[doc(alias = "GKTurnBasedMatchOutcomeFourth")]
93 pub const Fourth: Self = Self(9);
94 #[doc(alias = "GKTurnBasedMatchOutcomeCustomRange")]
95 pub const CustomRange: Self = Self(0x00FF0000);
96}
97
98unsafe impl Encode for GKTurnBasedMatchOutcome {
99 const ENCODING: Encoding = NSInteger::ENCODING;
100}
101
102unsafe impl RefEncode for GKTurnBasedMatchOutcome {
103 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
104}
105
106extern_class!(
107 #[unsafe(super(NSObject))]
115 #[derive(Debug, PartialEq, Eq, Hash)]
116 pub struct GKTurnBasedParticipant;
117);
118
119extern_conformance!(
120 unsafe impl NSObjectProtocol for GKTurnBasedParticipant {}
121);
122
123impl GKTurnBasedParticipant {
124 extern_methods!(
125 #[cfg(all(feature = "GKBasePlayer", feature = "GKPlayer"))]
126 #[unsafe(method(player))]
127 #[unsafe(method_family = none)]
128 pub unsafe fn player(&self) -> Option<Retained<GKPlayer>>;
129
130 #[unsafe(method(lastTurnDate))]
131 #[unsafe(method_family = none)]
132 pub unsafe fn lastTurnDate(&self) -> Option<Retained<NSDate>>;
133
134 #[unsafe(method(status))]
135 #[unsafe(method_family = none)]
136 pub unsafe fn status(&self) -> GKTurnBasedParticipantStatus;
137
138 #[unsafe(method(matchOutcome))]
139 #[unsafe(method_family = none)]
140 pub unsafe fn matchOutcome(&self) -> GKTurnBasedMatchOutcome;
141
142 #[unsafe(method(setMatchOutcome:))]
144 #[unsafe(method_family = none)]
145 pub unsafe fn setMatchOutcome(&self, match_outcome: GKTurnBasedMatchOutcome);
146
147 #[unsafe(method(timeoutDate))]
148 #[unsafe(method_family = none)]
149 pub unsafe fn timeoutDate(&self) -> Option<Retained<NSDate>>;
150 );
151}
152
153impl GKTurnBasedParticipant {
155 extern_methods!(
156 #[unsafe(method(init))]
157 #[unsafe(method_family = init)]
158 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
159
160 #[unsafe(method(new))]
161 #[unsafe(method_family = new)]
162 pub unsafe fn new() -> Retained<Self>;
163 );
164}
165
166impl GKTurnBasedParticipant {
168 extern_methods!(
169 #[deprecated]
171 #[unsafe(method(playerID))]
172 #[unsafe(method_family = none)]
173 pub unsafe fn playerID(&self) -> Option<Retained<NSString>>;
174 );
175}
176
177extern_protocol!(
178 pub unsafe trait GKTurnBasedEventListener {
180 #[cfg(all(feature = "GKBasePlayer", feature = "GKPlayer"))]
181 #[optional]
183 #[unsafe(method(player:didRequestMatchWithOtherPlayers:))]
184 #[unsafe(method_family = none)]
185 unsafe fn player_didRequestMatchWithOtherPlayers(
186 &self,
187 player: &GKPlayer,
188 players_to_invite: &NSArray<GKPlayer>,
189 );
190
191 #[cfg(all(feature = "GKBasePlayer", feature = "GKPlayer"))]
192 #[optional]
200 #[unsafe(method(player:receivedTurnEventForMatch:didBecomeActive:))]
201 #[unsafe(method_family = none)]
202 unsafe fn player_receivedTurnEventForMatch_didBecomeActive(
203 &self,
204 player: &GKPlayer,
205 r#match: &GKTurnBasedMatch,
206 did_become_active: bool,
207 );
208
209 #[cfg(all(feature = "GKBasePlayer", feature = "GKPlayer"))]
210 #[optional]
212 #[unsafe(method(player:matchEnded:))]
213 #[unsafe(method_family = none)]
214 unsafe fn player_matchEnded(&self, player: &GKPlayer, r#match: &GKTurnBasedMatch);
215
216 #[cfg(all(feature = "GKBasePlayer", feature = "GKPlayer"))]
217 #[optional]
219 #[unsafe(method(player:receivedExchangeRequest:forMatch:))]
220 #[unsafe(method_family = none)]
221 unsafe fn player_receivedExchangeRequest_forMatch(
222 &self,
223 player: &GKPlayer,
224 exchange: &GKTurnBasedExchange,
225 r#match: &GKTurnBasedMatch,
226 );
227
228 #[cfg(all(feature = "GKBasePlayer", feature = "GKPlayer"))]
229 #[optional]
231 #[unsafe(method(player:receivedExchangeCancellation:forMatch:))]
232 #[unsafe(method_family = none)]
233 unsafe fn player_receivedExchangeCancellation_forMatch(
234 &self,
235 player: &GKPlayer,
236 exchange: &GKTurnBasedExchange,
237 r#match: &GKTurnBasedMatch,
238 );
239
240 #[cfg(all(feature = "GKBasePlayer", feature = "GKPlayer"))]
241 #[optional]
243 #[unsafe(method(player:receivedExchangeReplies:forCompletedExchange:forMatch:))]
244 #[unsafe(method_family = none)]
245 unsafe fn player_receivedExchangeReplies_forCompletedExchange_forMatch(
246 &self,
247 player: &GKPlayer,
248 replies: &NSArray<GKTurnBasedExchangeReply>,
249 exchange: &GKTurnBasedExchange,
250 r#match: &GKTurnBasedMatch,
251 );
252
253 #[cfg(all(feature = "GKBasePlayer", feature = "GKPlayer"))]
254 #[optional]
256 #[unsafe(method(player:wantsToQuitMatch:))]
257 #[unsafe(method_family = none)]
258 unsafe fn player_wantsToQuitMatch(&self, player: &GKPlayer, r#match: &GKTurnBasedMatch);
259
260 #[cfg(all(feature = "GKBasePlayer", feature = "GKPlayer"))]
261 #[deprecated]
263 #[optional]
264 #[unsafe(method(player:didRequestMatchWithPlayers:))]
265 #[unsafe(method_family = none)]
266 unsafe fn player_didRequestMatchWithPlayers(
267 &self,
268 player: &GKPlayer,
269 player_i_ds_to_invite: &NSArray<NSString>,
270 );
271 }
272);
273
274extern "C" {
275 pub static GKTurnTimeoutDefault: NSTimeInterval;
277}
278
279extern "C" {
280 pub static GKTurnTimeoutNone: NSTimeInterval;
282}
283
284extern_class!(
285 #[unsafe(super(NSObject))]
287 #[derive(Debug, PartialEq, Eq, Hash)]
288 pub struct GKTurnBasedMatch;
289);
290
291extern_conformance!(
292 unsafe impl NSObjectProtocol for GKTurnBasedMatch {}
293);
294
295impl GKTurnBasedMatch {
296 extern_methods!(
297 #[unsafe(method(matchID))]
298 #[unsafe(method_family = none)]
299 pub unsafe fn matchID(&self) -> Retained<NSString>;
300
301 #[unsafe(method(creationDate))]
302 #[unsafe(method_family = none)]
303 pub unsafe fn creationDate(&self) -> Retained<NSDate>;
304
305 #[unsafe(method(participants))]
306 #[unsafe(method_family = none)]
307 pub unsafe fn participants(&self) -> Retained<NSArray<GKTurnBasedParticipant>>;
308
309 #[unsafe(method(status))]
310 #[unsafe(method_family = none)]
311 pub unsafe fn status(&self) -> GKTurnBasedMatchStatus;
312
313 #[unsafe(method(currentParticipant))]
314 #[unsafe(method_family = none)]
315 pub unsafe fn currentParticipant(&self) -> Option<Retained<GKTurnBasedParticipant>>;
316
317 #[unsafe(method(matchData))]
318 #[unsafe(method_family = none)]
319 pub unsafe fn matchData(&self) -> Option<Retained<NSData>>;
320
321 #[unsafe(method(setLocalizableMessageWithKey:arguments:))]
322 #[unsafe(method_family = none)]
323 pub unsafe fn setLocalizableMessageWithKey_arguments(
324 &self,
325 key: &NSString,
326 arguments: Option<&NSArray<NSString>>,
327 );
328
329 #[unsafe(method(message))]
330 #[unsafe(method_family = none)]
331 pub unsafe fn message(&self) -> Option<Retained<NSString>>;
332
333 #[unsafe(method(setMessage:))]
337 #[unsafe(method_family = none)]
338 pub unsafe fn setMessage(&self, message: Option<&NSString>);
339
340 #[unsafe(method(matchDataMaximumSize))]
341 #[unsafe(method_family = none)]
342 pub unsafe fn matchDataMaximumSize(&self) -> NSUInteger;
343
344 #[unsafe(method(exchanges))]
345 #[unsafe(method_family = none)]
346 pub unsafe fn exchanges(&self) -> Option<Retained<NSArray<GKTurnBasedExchange>>>;
347
348 #[unsafe(method(activeExchanges))]
349 #[unsafe(method_family = none)]
350 pub unsafe fn activeExchanges(&self) -> Option<Retained<NSArray<GKTurnBasedExchange>>>;
351
352 #[unsafe(method(completedExchanges))]
353 #[unsafe(method_family = none)]
354 pub unsafe fn completedExchanges(&self) -> Option<Retained<NSArray<GKTurnBasedExchange>>>;
355
356 #[unsafe(method(exchangeDataMaximumSize))]
357 #[unsafe(method_family = none)]
358 pub unsafe fn exchangeDataMaximumSize(&self) -> NSUInteger;
359
360 #[unsafe(method(exchangeMaxInitiatedExchangesPerPlayer))]
361 #[unsafe(method_family = none)]
362 pub unsafe fn exchangeMaxInitiatedExchangesPerPlayer(&self) -> NSUInteger;
363
364 #[cfg(all(feature = "GKMatchmaker", feature = "block2"))]
365 #[unsafe(method(findMatchForRequest:withCompletionHandler:))]
366 #[unsafe(method_family = none)]
367 pub unsafe fn findMatchForRequest_withCompletionHandler(
368 request: &GKMatchRequest,
369 completion_handler: &block2::DynBlock<dyn Fn(*mut GKTurnBasedMatch, *mut NSError)>,
370 );
371
372 #[cfg(feature = "block2")]
373 #[unsafe(method(loadMatchesWithCompletionHandler:))]
374 #[unsafe(method_family = none)]
375 pub unsafe fn loadMatchesWithCompletionHandler(
376 completion_handler: Option<
377 &block2::DynBlock<dyn Fn(*mut NSArray<GKTurnBasedMatch>, *mut NSError)>,
378 >,
379 );
380
381 #[cfg(feature = "block2")]
382 #[unsafe(method(loadMatchWithID:withCompletionHandler:))]
383 #[unsafe(method_family = none)]
384 pub unsafe fn loadMatchWithID_withCompletionHandler(
385 match_id: &NSString,
386 completion_handler: Option<
387 &block2::DynBlock<dyn Fn(*mut GKTurnBasedMatch, *mut NSError)>,
388 >,
389 );
390
391 #[cfg(feature = "block2")]
392 #[unsafe(method(rematchWithCompletionHandler:))]
393 #[unsafe(method_family = none)]
394 pub unsafe fn rematchWithCompletionHandler(
395 &self,
396 completion_handler: Option<
397 &block2::DynBlock<dyn Fn(*mut GKTurnBasedMatch, *mut NSError)>,
398 >,
399 );
400
401 #[cfg(feature = "block2")]
402 #[unsafe(method(acceptInviteWithCompletionHandler:))]
403 #[unsafe(method_family = none)]
404 pub unsafe fn acceptInviteWithCompletionHandler(
405 &self,
406 completion_handler: Option<
407 &block2::DynBlock<dyn Fn(*mut GKTurnBasedMatch, *mut NSError)>,
408 >,
409 );
410
411 #[cfg(feature = "block2")]
412 #[unsafe(method(declineInviteWithCompletionHandler:))]
413 #[unsafe(method_family = none)]
414 pub unsafe fn declineInviteWithCompletionHandler(
415 &self,
416 completion_handler: Option<&block2::DynBlock<dyn Fn(*mut NSError)>>,
417 );
418
419 #[cfg(feature = "block2")]
420 #[unsafe(method(removeWithCompletionHandler:))]
421 #[unsafe(method_family = none)]
422 pub unsafe fn removeWithCompletionHandler(
423 &self,
424 completion_handler: Option<&block2::DynBlock<dyn Fn(*mut NSError)>>,
425 );
426
427 #[cfg(feature = "block2")]
428 #[unsafe(method(loadMatchDataWithCompletionHandler:))]
429 #[unsafe(method_family = none)]
430 pub unsafe fn loadMatchDataWithCompletionHandler(
431 &self,
432 completion_handler: Option<&block2::DynBlock<dyn Fn(*mut NSData, *mut NSError)>>,
433 );
434
435 #[cfg(feature = "block2")]
436 #[unsafe(method(endTurnWithNextParticipants:turnTimeout:matchData:completionHandler:))]
437 #[unsafe(method_family = none)]
438 pub unsafe fn endTurnWithNextParticipants_turnTimeout_matchData_completionHandler(
439 &self,
440 next_participants: &NSArray<GKTurnBasedParticipant>,
441 timeout: NSTimeInterval,
442 match_data: &NSData,
443 completion_handler: Option<&block2::DynBlock<dyn Fn(*mut NSError)>>,
444 );
445
446 #[cfg(feature = "block2")]
447 #[unsafe(method(participantQuitInTurnWithOutcome:nextParticipants:turnTimeout:matchData:completionHandler:))]
448 #[unsafe(method_family = none)]
449 pub unsafe fn participantQuitInTurnWithOutcome_nextParticipants_turnTimeout_matchData_completionHandler(
450 &self,
451 match_outcome: GKTurnBasedMatchOutcome,
452 next_participants: &NSArray<GKTurnBasedParticipant>,
453 timeout: NSTimeInterval,
454 match_data: &NSData,
455 completion_handler: Option<&block2::DynBlock<dyn Fn(*mut NSError)>>,
456 );
457
458 #[cfg(feature = "block2")]
459 #[unsafe(method(participantQuitOutOfTurnWithOutcome:withCompletionHandler:))]
460 #[unsafe(method_family = none)]
461 pub unsafe fn participantQuitOutOfTurnWithOutcome_withCompletionHandler(
462 &self,
463 match_outcome: GKTurnBasedMatchOutcome,
464 completion_handler: Option<&block2::DynBlock<dyn Fn(*mut NSError)>>,
465 );
466
467 #[cfg(feature = "block2")]
468 #[unsafe(method(endMatchInTurnWithMatchData:completionHandler:))]
469 #[unsafe(method_family = none)]
470 pub unsafe fn endMatchInTurnWithMatchData_completionHandler(
471 &self,
472 match_data: &NSData,
473 completion_handler: Option<&block2::DynBlock<dyn Fn(*mut NSError)>>,
474 );
475
476 #[cfg(all(feature = "GKAchievement", feature = "GKScore", feature = "block2"))]
477 #[deprecated]
478 #[unsafe(method(endMatchInTurnWithMatchData:scores:achievements:completionHandler:))]
479 #[unsafe(method_family = none)]
480 pub unsafe fn endMatchInTurnWithMatchData_scores_achievements_completionHandler(
481 &self,
482 match_data: &NSData,
483 scores: Option<&NSArray<GKScore>>,
484 achievements: Option<&NSArray<GKAchievement>>,
485 completion_handler: Option<&block2::DynBlock<dyn Fn(*mut NSError)>>,
486 );
487
488 #[cfg(all(feature = "GKLeaderboardScore", feature = "block2"))]
489 #[unsafe(method(endMatchInTurnWithMatchData:leaderboardScores:achievements:completionHandler:))]
493 #[unsafe(method_family = none)]
494 pub unsafe fn endMatchInTurnWithMatchData_leaderboardScores_achievements_completionHandler(
495 &self,
496 match_data: &NSData,
497 scores: &NSArray<GKLeaderboardScore>,
498 achievements: &NSArray,
499 completion_handler: &block2::DynBlock<dyn Fn(*mut NSError)>,
500 );
501
502 #[cfg(feature = "block2")]
503 #[unsafe(method(saveCurrentTurnWithMatchData:completionHandler:))]
504 #[unsafe(method_family = none)]
505 pub unsafe fn saveCurrentTurnWithMatchData_completionHandler(
506 &self,
507 match_data: &NSData,
508 completion_handler: Option<&block2::DynBlock<dyn Fn(*mut NSError)>>,
509 );
510
511 #[cfg(feature = "block2")]
512 #[unsafe(method(saveMergedMatchData:withResolvedExchanges:completionHandler:))]
513 #[unsafe(method_family = none)]
514 pub unsafe fn saveMergedMatchData_withResolvedExchanges_completionHandler(
515 &self,
516 match_data: &NSData,
517 exchanges: &NSArray<GKTurnBasedExchange>,
518 completion_handler: Option<&block2::DynBlock<dyn Fn(*mut NSError)>>,
519 );
520
521 #[cfg(feature = "block2")]
522 #[unsafe(method(sendExchangeToParticipants:data:localizableMessageKey:arguments:timeout:completionHandler:))]
523 #[unsafe(method_family = none)]
524 pub unsafe fn sendExchangeToParticipants_data_localizableMessageKey_arguments_timeout_completionHandler(
525 &self,
526 participants: &NSArray<GKTurnBasedParticipant>,
527 data: &NSData,
528 key: &NSString,
529 arguments: &NSArray<NSString>,
530 timeout: NSTimeInterval,
531 completion_handler: Option<
532 &block2::DynBlock<dyn Fn(*mut GKTurnBasedExchange, *mut NSError)>,
533 >,
534 );
535
536 #[cfg(feature = "block2")]
537 #[unsafe(method(sendReminderToParticipants:localizableMessageKey:arguments:completionHandler:))]
538 #[unsafe(method_family = none)]
539 pub unsafe fn sendReminderToParticipants_localizableMessageKey_arguments_completionHandler(
540 &self,
541 participants: &NSArray<GKTurnBasedParticipant>,
542 key: &NSString,
543 arguments: &NSArray<NSString>,
544 completion_handler: Option<&block2::DynBlock<dyn Fn(*mut NSError)>>,
545 );
546
547 #[cfg(feature = "block2")]
548 #[deprecated]
549 #[unsafe(method(endTurnWithNextParticipant:matchData:completionHandler:))]
550 #[unsafe(method_family = none)]
551 pub unsafe fn endTurnWithNextParticipant_matchData_completionHandler(
552 &self,
553 next_participant: &GKTurnBasedParticipant,
554 match_data: &NSData,
555 completion_handler: Option<&block2::DynBlock<dyn Fn(*mut NSError)>>,
556 );
557
558 #[cfg(feature = "block2")]
559 #[deprecated]
560 #[unsafe(method(participantQuitInTurnWithOutcome:nextParticipant:matchData:completionHandler:))]
561 #[unsafe(method_family = none)]
562 pub unsafe fn participantQuitInTurnWithOutcome_nextParticipant_matchData_completionHandler(
563 &self,
564 match_outcome: GKTurnBasedMatchOutcome,
565 next_participant: &GKTurnBasedParticipant,
566 match_data: &NSData,
567 completion_handler: Option<&block2::DynBlock<dyn Fn(*mut NSError)>>,
568 );
569 );
570}
571
572impl GKTurnBasedMatch {
574 extern_methods!(
575 #[unsafe(method(init))]
576 #[unsafe(method_family = init)]
577 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
578
579 #[unsafe(method(new))]
580 #[unsafe(method_family = new)]
581 pub unsafe fn new() -> Retained<Self>;
582 );
583}
584
585#[repr(transparent)]
588#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
589pub struct GKTurnBasedExchangeStatus(pub i8);
590impl GKTurnBasedExchangeStatus {
591 #[doc(alias = "GKTurnBasedExchangeStatusUnknown")]
592 pub const Unknown: Self = Self(0);
593 #[doc(alias = "GKTurnBasedExchangeStatusActive")]
594 pub const Active: Self = Self(1);
595 #[doc(alias = "GKTurnBasedExchangeStatusComplete")]
596 pub const Complete: Self = Self(2);
597 #[doc(alias = "GKTurnBasedExchangeStatusResolved")]
598 pub const Resolved: Self = Self(3);
599 #[doc(alias = "GKTurnBasedExchangeStatusCanceled")]
600 pub const Canceled: Self = Self(4);
601}
602
603unsafe impl Encode for GKTurnBasedExchangeStatus {
604 const ENCODING: Encoding = i8::ENCODING;
605}
606
607unsafe impl RefEncode for GKTurnBasedExchangeStatus {
608 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
609}
610
611extern "C" {
612 pub static GKExchangeTimeoutDefault: NSTimeInterval;
614}
615
616extern "C" {
617 pub static GKExchangeTimeoutNone: NSTimeInterval;
619}
620
621extern_class!(
622 #[unsafe(super(NSObject))]
624 #[derive(Debug, PartialEq, Eq, Hash)]
625 pub struct GKTurnBasedExchange;
626);
627
628extern_conformance!(
629 unsafe impl NSObjectProtocol for GKTurnBasedExchange {}
630);
631
632impl GKTurnBasedExchange {
633 extern_methods!(
634 #[unsafe(method(exchangeID))]
635 #[unsafe(method_family = none)]
636 pub unsafe fn exchangeID(&self) -> Retained<NSString>;
637
638 #[unsafe(method(sender))]
639 #[unsafe(method_family = none)]
640 pub unsafe fn sender(&self) -> Retained<GKTurnBasedParticipant>;
641
642 #[unsafe(method(recipients))]
643 #[unsafe(method_family = none)]
644 pub unsafe fn recipients(&self) -> Retained<NSArray<GKTurnBasedParticipant>>;
645
646 #[unsafe(method(status))]
647 #[unsafe(method_family = none)]
648 pub unsafe fn status(&self) -> GKTurnBasedExchangeStatus;
649
650 #[unsafe(method(message))]
651 #[unsafe(method_family = none)]
652 pub unsafe fn message(&self) -> Option<Retained<NSString>>;
653
654 #[unsafe(method(data))]
655 #[unsafe(method_family = none)]
656 pub unsafe fn data(&self) -> Option<Retained<NSData>>;
657
658 #[unsafe(method(sendDate))]
659 #[unsafe(method_family = none)]
660 pub unsafe fn sendDate(&self) -> Retained<NSDate>;
661
662 #[unsafe(method(timeoutDate))]
663 #[unsafe(method_family = none)]
664 pub unsafe fn timeoutDate(&self) -> Option<Retained<NSDate>>;
665
666 #[unsafe(method(completionDate))]
667 #[unsafe(method_family = none)]
668 pub unsafe fn completionDate(&self) -> Option<Retained<NSDate>>;
669
670 #[unsafe(method(replies))]
671 #[unsafe(method_family = none)]
672 pub unsafe fn replies(&self) -> Option<Retained<NSArray<GKTurnBasedExchangeReply>>>;
673
674 #[cfg(feature = "block2")]
675 #[unsafe(method(cancelWithLocalizableMessageKey:arguments:completionHandler:))]
676 #[unsafe(method_family = none)]
677 pub unsafe fn cancelWithLocalizableMessageKey_arguments_completionHandler(
678 &self,
679 key: &NSString,
680 arguments: &NSArray<NSString>,
681 completion_handler: Option<&block2::DynBlock<dyn Fn(*mut NSError)>>,
682 );
683
684 #[cfg(feature = "block2")]
685 #[unsafe(method(replyWithLocalizableMessageKey:arguments:data:completionHandler:))]
686 #[unsafe(method_family = none)]
687 pub unsafe fn replyWithLocalizableMessageKey_arguments_data_completionHandler(
688 &self,
689 key: &NSString,
690 arguments: &NSArray<NSString>,
691 data: &NSData,
692 completion_handler: Option<&block2::DynBlock<dyn Fn(*mut NSError)>>,
693 );
694 );
695}
696
697impl GKTurnBasedExchange {
699 extern_methods!(
700 #[unsafe(method(init))]
701 #[unsafe(method_family = init)]
702 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
703
704 #[unsafe(method(new))]
705 #[unsafe(method_family = new)]
706 pub unsafe fn new() -> Retained<Self>;
707 );
708}
709
710extern_class!(
711 #[unsafe(super(NSObject))]
713 #[derive(Debug, PartialEq, Eq, Hash)]
714 pub struct GKTurnBasedExchangeReply;
715);
716
717extern_conformance!(
718 unsafe impl NSObjectProtocol for GKTurnBasedExchangeReply {}
719);
720
721impl GKTurnBasedExchangeReply {
722 extern_methods!(
723 #[unsafe(method(recipient))]
724 #[unsafe(method_family = none)]
725 pub unsafe fn recipient(&self) -> Retained<GKTurnBasedParticipant>;
726
727 #[unsafe(method(message))]
728 #[unsafe(method_family = none)]
729 pub unsafe fn message(&self) -> Option<Retained<NSString>>;
730
731 #[unsafe(method(data))]
732 #[unsafe(method_family = none)]
733 pub unsafe fn data(&self) -> Option<Retained<NSData>>;
734
735 #[unsafe(method(replyDate))]
736 #[unsafe(method_family = none)]
737 pub unsafe fn replyDate(&self) -> Retained<NSDate>;
738 );
739}
740
741impl GKTurnBasedExchangeReply {
743 extern_methods!(
744 #[unsafe(method(init))]
745 #[unsafe(method_family = init)]
746 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
747
748 #[unsafe(method(new))]
749 #[unsafe(method_family = new)]
750 pub unsafe fn new() -> Retained<Self>;
751 );
752}
753
754extern_protocol!(
755 #[deprecated]
757 pub unsafe trait GKTurnBasedEventHandlerDelegate {
758 #[deprecated]
759 #[unsafe(method(handleInviteFromGameCenter:))]
760 #[unsafe(method_family = none)]
761 unsafe fn handleInviteFromGameCenter(&self, players_to_invite: &NSArray<NSString>);
762
763 #[deprecated]
764 #[unsafe(method(handleTurnEventForMatch:didBecomeActive:))]
765 #[unsafe(method_family = none)]
766 unsafe fn handleTurnEventForMatch_didBecomeActive(
767 &self,
768 r#match: &GKTurnBasedMatch,
769 did_become_active: bool,
770 );
771
772 #[deprecated]
773 #[optional]
774 #[unsafe(method(handleTurnEventForMatch:))]
775 #[unsafe(method_family = none)]
776 unsafe fn handleTurnEventForMatch(&self, r#match: &GKTurnBasedMatch);
777
778 #[deprecated]
779 #[optional]
780 #[unsafe(method(handleMatchEnded:))]
781 #[unsafe(method_family = none)]
782 unsafe fn handleMatchEnded(&self, r#match: &GKTurnBasedMatch);
783 }
784);
785
786extern_class!(
787 #[unsafe(super(NSObject))]
789 #[derive(Debug, PartialEq, Eq, Hash)]
790 #[deprecated]
791 pub struct GKTurnBasedEventHandler;
792);
793
794extern_conformance!(
795 unsafe impl NSObjectProtocol for GKTurnBasedEventHandler {}
796);
797
798impl GKTurnBasedEventHandler {
799 extern_methods!(
800 #[deprecated]
801 #[unsafe(method(sharedTurnBasedEventHandler))]
802 #[unsafe(method_family = none)]
803 pub unsafe fn sharedTurnBasedEventHandler() -> Retained<GKTurnBasedEventHandler>;
804
805 #[deprecated]
806 #[unsafe(method(delegate))]
807 #[unsafe(method_family = none)]
808 pub unsafe fn delegate(&self) -> Option<Retained<NSObject>>;
809
810 #[deprecated]
818 #[unsafe(method(setDelegate:))]
819 #[unsafe(method_family = none)]
820 pub unsafe fn setDelegate(&self, delegate: Option<&NSObject>);
821 );
822}
823
824impl GKTurnBasedEventHandler {
826 extern_methods!(
827 #[unsafe(method(init))]
828 #[unsafe(method_family = init)]
829 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
830
831 #[unsafe(method(new))]
832 #[unsafe(method_family = new)]
833 pub unsafe fn new() -> Retained<Self>;
834 );
835}