objc2_game_kit/generated/
GKGameSession.rs1use core::ffi::*;
4use core::ptr::NonNull;
5use objc2::__framework_prelude::*;
6use objc2_foundation::*;
7
8use crate::*;
9
10#[repr(transparent)]
13#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
14pub struct GKConnectionState(pub NSInteger);
15impl GKConnectionState {
16 #[doc(alias = "GKConnectionStateNotConnected")]
17 pub const NotConnected: Self = Self(0);
18 #[doc(alias = "GKConnectionStateConnected")]
19 pub const Connected: Self = Self(1);
20}
21
22unsafe impl Encode for GKConnectionState {
23 const ENCODING: Encoding = NSInteger::ENCODING;
24}
25
26unsafe impl RefEncode for GKConnectionState {
27 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
28}
29
30#[repr(transparent)]
33#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
34pub struct GKTransportType(pub NSInteger);
35impl GKTransportType {
36 #[doc(alias = "GKTransportTypeUnreliable")]
37 pub const Unreliable: Self = Self(0);
38 #[doc(alias = "GKTransportTypeReliable")]
39 pub const Reliable: Self = Self(1);
40}
41
42unsafe impl Encode for GKTransportType {
43 const ENCODING: Encoding = NSInteger::ENCODING;
44}
45
46unsafe impl RefEncode for GKTransportType {
47 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
48}
49
50extern_class!(
51 #[unsafe(super(NSObject))]
53 #[derive(Debug, PartialEq, Eq, Hash)]
54 #[deprecated = "For real-time matches, use GKMatchmakerViewController. For turn-based matches, use GKTurnBasedMatchmakerViewController."]
55 pub struct GKGameSession;
56);
57
58extern_conformance!(
59 unsafe impl NSObjectProtocol for GKGameSession {}
60);
61
62impl GKGameSession {
63 extern_methods!(
64 #[deprecated = "For real-time matches, use GKMatchmakerViewController. For turn-based matches, use GKTurnBasedMatchmakerViewController."]
65 #[unsafe(method(identifier))]
66 #[unsafe(method_family = none)]
67 pub unsafe fn identifier(&self) -> Retained<NSString>;
68
69 #[deprecated = "For real-time matches, use GKMatchmakerViewController. For turn-based matches, use GKTurnBasedMatchmakerViewController."]
70 #[unsafe(method(title))]
71 #[unsafe(method_family = none)]
72 pub unsafe fn title(&self) -> Retained<NSString>;
73
74 #[cfg(all(feature = "GKBasePlayer", feature = "GKCloudPlayer"))]
75 #[deprecated = "For real-time matches, use GKMatchmakerViewController. For turn-based matches, use GKTurnBasedMatchmakerViewController."]
76 #[unsafe(method(owner))]
77 #[unsafe(method_family = none)]
78 pub unsafe fn owner(&self) -> Retained<GKCloudPlayer>;
79
80 #[cfg(all(feature = "GKBasePlayer", feature = "GKCloudPlayer"))]
81 #[deprecated = "For real-time matches, use GKMatchmakerViewController. For turn-based matches, use GKTurnBasedMatchmakerViewController."]
82 #[unsafe(method(players))]
83 #[unsafe(method_family = none)]
84 pub unsafe fn players(&self) -> Retained<NSArray<GKCloudPlayer>>;
85
86 #[deprecated = "For real-time matches, use GKMatchmakerViewController. For turn-based matches, use GKTurnBasedMatchmakerViewController."]
87 #[unsafe(method(lastModifiedDate))]
88 #[unsafe(method_family = none)]
89 pub unsafe fn lastModifiedDate(&self) -> Retained<NSDate>;
90
91 #[cfg(all(feature = "GKBasePlayer", feature = "GKCloudPlayer"))]
92 #[deprecated = "For real-time matches, use GKMatchmakerViewController. For turn-based matches, use GKTurnBasedMatchmakerViewController."]
93 #[unsafe(method(lastModifiedPlayer))]
94 #[unsafe(method_family = none)]
95 pub unsafe fn lastModifiedPlayer(&self) -> Retained<GKCloudPlayer>;
96
97 #[deprecated = "For real-time matches, use GKMatchmakerViewController. For turn-based matches, use GKTurnBasedMatchmakerViewController."]
98 #[unsafe(method(maxNumberOfConnectedPlayers))]
99 #[unsafe(method_family = none)]
100 pub unsafe fn maxNumberOfConnectedPlayers(&self) -> NSInteger;
101
102 #[cfg(all(feature = "GKBasePlayer", feature = "GKCloudPlayer"))]
103 #[deprecated = "For real-time matches, use GKMatchmakerViewController. For turn-based matches, use GKTurnBasedMatchmakerViewController."]
104 #[unsafe(method(badgedPlayers))]
105 #[unsafe(method_family = none)]
106 pub unsafe fn badgedPlayers(&self) -> Retained<NSArray<GKCloudPlayer>>;
107
108 #[cfg(feature = "block2")]
109 #[deprecated = "For real-time matches, use GKMatchmakerViewController. For turn-based matches, use GKTurnBasedMatchmakerViewController."]
110 #[unsafe(method(createSessionInContainer:withTitle:maxConnectedPlayers:completionHandler:))]
111 #[unsafe(method_family = none)]
112 pub unsafe fn createSessionInContainer_withTitle_maxConnectedPlayers_completionHandler(
113 container_name: Option<&NSString>,
114 title: &NSString,
115 max_players: NSInteger,
116 completion_handler: &block2::DynBlock<dyn Fn(*mut GKGameSession, *mut NSError)>,
117 );
118
119 #[cfg(feature = "block2")]
120 #[deprecated = "For real-time matches, use GKMatchmakerViewController. For turn-based matches, use GKTurnBasedMatchmakerViewController."]
121 #[unsafe(method(loadSessionsInContainer:completionHandler:))]
122 #[unsafe(method_family = none)]
123 pub unsafe fn loadSessionsInContainer_completionHandler(
124 container_name: Option<&NSString>,
125 completion_handler: &block2::DynBlock<
126 dyn Fn(*mut NSArray<GKGameSession>, *mut NSError),
127 >,
128 );
129
130 #[cfg(feature = "block2")]
131 #[deprecated = "For real-time matches, use GKMatchmakerViewController. For turn-based matches, use GKTurnBasedMatchmakerViewController."]
132 #[unsafe(method(loadSessionWithIdentifier:completionHandler:))]
133 #[unsafe(method_family = none)]
134 pub unsafe fn loadSessionWithIdentifier_completionHandler(
135 identifier: &NSString,
136 completion_handler: &block2::DynBlock<dyn Fn(*mut GKGameSession, *mut NSError)>,
137 );
138
139 #[cfg(feature = "block2")]
140 #[deprecated = "For real-time matches, use GKMatchmakerViewController. For turn-based matches, use GKTurnBasedMatchmakerViewController."]
141 #[unsafe(method(removeSessionWithIdentifier:completionHandler:))]
142 #[unsafe(method_family = none)]
143 pub unsafe fn removeSessionWithIdentifier_completionHandler(
144 identifier: &NSString,
145 completion_handler: &block2::DynBlock<dyn Fn(*mut NSError)>,
146 );
147
148 #[cfg(feature = "block2")]
149 #[deprecated = "For real-time matches, use GKMatchmakerViewController. For turn-based matches, use GKTurnBasedMatchmakerViewController."]
150 #[unsafe(method(getShareURLWithCompletionHandler:))]
151 #[unsafe(method_family = none)]
152 pub unsafe fn getShareURLWithCompletionHandler(
153 &self,
154 completion_handler: &block2::DynBlock<dyn Fn(*mut NSURL, *mut NSError)>,
155 );
156
157 #[cfg(feature = "block2")]
158 #[deprecated = "For real-time matches, use GKMatchmakerViewController. For turn-based matches, use GKTurnBasedMatchmakerViewController."]
159 #[unsafe(method(loadDataWithCompletionHandler:))]
160 #[unsafe(method_family = none)]
161 pub unsafe fn loadDataWithCompletionHandler(
162 &self,
163 completion_handler: &block2::DynBlock<dyn Fn(*mut NSData, *mut NSError)>,
164 );
165
166 #[cfg(feature = "block2")]
167 #[deprecated = "For real-time matches, use GKMatchmakerViewController. For turn-based matches, use GKTurnBasedMatchmakerViewController."]
168 #[unsafe(method(saveData:completionHandler:))]
169 #[unsafe(method_family = none)]
170 pub unsafe fn saveData_completionHandler(
171 &self,
172 data: &NSData,
173 completion_handler: &block2::DynBlock<dyn Fn(*mut NSData, *mut NSError)>,
174 );
175
176 #[cfg(feature = "block2")]
177 #[deprecated = "For real-time matches, use GKMatchmakerViewController. For turn-based matches, use GKTurnBasedMatchmakerViewController."]
178 #[unsafe(method(setConnectionState:completionHandler:))]
179 #[unsafe(method_family = none)]
180 pub unsafe fn setConnectionState_completionHandler(
181 &self,
182 state: GKConnectionState,
183 completion_handler: &block2::DynBlock<dyn Fn(*mut NSError)>,
184 );
185
186 #[cfg(all(feature = "GKBasePlayer", feature = "GKCloudPlayer"))]
187 #[deprecated = "For real-time matches, use GKMatchmakerViewController. For turn-based matches, use GKTurnBasedMatchmakerViewController."]
188 #[unsafe(method(playersWithConnectionState:))]
189 #[unsafe(method_family = none)]
190 pub unsafe fn playersWithConnectionState(
191 &self,
192 state: GKConnectionState,
193 ) -> Retained<NSArray<GKCloudPlayer>>;
194
195 #[cfg(feature = "block2")]
196 #[deprecated = "For real-time matches, use GKMatchmakerViewController. For turn-based matches, use GKTurnBasedMatchmakerViewController."]
197 #[unsafe(method(sendData:withTransportType:completionHandler:))]
198 #[unsafe(method_family = none)]
199 pub unsafe fn sendData_withTransportType_completionHandler(
200 &self,
201 data: &NSData,
202 transport: GKTransportType,
203 completion_handler: &block2::DynBlock<dyn Fn(*mut NSError)>,
204 );
205
206 #[cfg(all(
207 feature = "GKBasePlayer",
208 feature = "GKCloudPlayer",
209 feature = "block2"
210 ))]
211 #[deprecated = "For real-time matches, use GKMatchmakerViewController. For turn-based matches, use GKTurnBasedMatchmakerViewController."]
212 #[unsafe(method(sendMessageWithLocalizedFormatKey:arguments:data:toPlayers:badgePlayers:completionHandler:))]
213 #[unsafe(method_family = none)]
214 pub unsafe fn sendMessageWithLocalizedFormatKey_arguments_data_toPlayers_badgePlayers_completionHandler(
215 &self,
216 key: &NSString,
217 arguments: &NSArray<NSString>,
218 data: Option<&NSData>,
219 players: &NSArray<GKCloudPlayer>,
220 badge_players: bool,
221 completion_handler: &block2::DynBlock<dyn Fn(*mut NSError)>,
222 );
223
224 #[cfg(all(
225 feature = "GKBasePlayer",
226 feature = "GKCloudPlayer",
227 feature = "block2"
228 ))]
229 #[deprecated = "For real-time matches, use GKMatchmakerViewController. For turn-based matches, use GKTurnBasedMatchmakerViewController."]
230 #[unsafe(method(clearBadgeForPlayers:completionHandler:))]
231 #[unsafe(method_family = none)]
232 pub unsafe fn clearBadgeForPlayers_completionHandler(
233 &self,
234 players: &NSArray<GKCloudPlayer>,
235 completion_handler: &block2::DynBlock<dyn Fn(*mut NSError)>,
236 );
237 );
238}
239
240impl GKGameSession {
242 extern_methods!(
243 #[unsafe(method(init))]
244 #[unsafe(method_family = init)]
245 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
246
247 #[unsafe(method(new))]
248 #[unsafe(method_family = new)]
249 pub unsafe fn new() -> Retained<Self>;
250 );
251}