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
//! 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::*;
#[cfg(feature = "objc2-app-kit")]
#[cfg(target_os = "macos")]
use objc2_app_kit::*;
use objc2_foundation::*;
use crate::*;
extern_class!(
/// [Apple's documentation](https://developer.apple.com/documentation/gamekit/gkgameactivitydefinition?language=objc)
#[unsafe(super(NSObject))]
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct GKGameActivityDefinition;
);
unsafe impl Send for GKGameActivityDefinition {}
unsafe impl Sync for GKGameActivityDefinition {}
extern_conformance!(
unsafe impl NSObjectProtocol for GKGameActivityDefinition {}
);
impl GKGameActivityDefinition {
extern_methods!(
/// The developer defined identifier for a given game activity.
///
/// This property is not atomic.
///
/// # Safety
///
/// This might not be thread-safe.
#[unsafe(method(identifier))]
#[unsafe(method_family = none)]
pub unsafe fn identifier(&self) -> Retained<NSString>;
/// The group identifier for the activity, if one exists.
///
/// This property is not atomic.
///
/// # Safety
///
/// This might not be thread-safe.
#[unsafe(method(groupIdentifier))]
#[unsafe(method_family = none)]
pub unsafe fn groupIdentifier(&self) -> Option<Retained<NSString>>;
/// A short title for the game activity.
///
/// This property is not atomic.
///
/// # Safety
///
/// This might not be thread-safe.
#[unsafe(method(title))]
#[unsafe(method_family = none)]
pub unsafe fn title(&self) -> Retained<NSString>;
/// A more detailed description of the game activity.
///
/// This property is not atomic.
///
/// # Safety
///
/// This might not be thread-safe.
#[unsafe(method(details))]
#[unsafe(method_family = none)]
pub unsafe fn details(&self) -> Option<Retained<NSString>>;
/// Default properties defined by the developer for this type of game activity.
///
/// This property is not atomic.
///
/// # Safety
///
/// This might not be thread-safe.
#[unsafe(method(defaultProperties))]
#[unsafe(method_family = none)]
pub unsafe fn defaultProperties(&self) -> Retained<NSDictionary<NSString, NSString>>;
/// A fallback URL that can be used to construct a game-specific URL for players to share or join, if the joining device does not support the default URL.
///
/// This property is not atomic.
///
/// # Safety
///
/// This might not be thread-safe.
#[unsafe(method(fallbackURL))]
#[unsafe(method_family = none)]
pub unsafe fn fallbackURL(&self) -> Option<Retained<NSURL>>;
/// Whether the activity can be joined by others via a party code.
/// - SeeAlso: ``-[GKGameActivityListener player:wantsToPlayGameActivity:completionHandler:]`` where you can receive and handle game activities that players want to play in a party with friends.
///
/// This property is not atomic.
///
/// # Safety
///
/// This might not be thread-safe.
#[unsafe(method(supportsPartyCode))]
#[unsafe(method_family = none)]
pub unsafe fn supportsPartyCode(&self) -> bool;
/// The maximum number of participants that can join the activity. Returns nil when no maximum is set (unlimited players) or when player range is undefined. When not nil, the value is always greater than or equal to `minPlayers`.
///
/// This property is not atomic.
///
/// # Safety
///
/// This might not be thread-safe.
#[unsafe(method(maxPlayers))]
#[unsafe(method_family = none)]
pub unsafe fn maxPlayers(&self) -> Option<Retained<NSNumber>>;
/// The minimum number of participants that can join the activity.
///
/// This property is not atomic.
///
/// # Safety
///
/// This might not be thread-safe.
#[unsafe(method(minPlayers))]
#[unsafe(method_family = none)]
pub unsafe fn minPlayers(&self) -> Option<Retained<NSNumber>>;
/// True if the activity supports an unlimited number of players. False if maxPlayers is set to a defined limit or if no player range is provided.
///
/// This property is not atomic.
///
/// # Safety
///
/// This might not be thread-safe.
#[unsafe(method(supportsUnlimitedPlayers))]
#[unsafe(method_family = none)]
pub unsafe fn supportsUnlimitedPlayers(&self) -> bool;
#[cfg(feature = "GKGameActivityPlayStyle")]
/// The play style of the game activity.
///
/// This property is not atomic.
///
/// # Safety
///
/// This might not be thread-safe.
#[unsafe(method(playStyle))]
#[unsafe(method_family = none)]
pub unsafe fn playStyle(&self) -> GKGameActivityPlayStyle;
#[cfg(feature = "GKReleaseState")]
/// The release state of the game activity definition in App Store Connect.
///
/// This property is not atomic.
///
/// # Safety
///
/// This might not be thread-safe.
#[unsafe(method(releaseState))]
#[unsafe(method_family = none)]
pub unsafe fn releaseState(&self) -> GKReleaseState;
#[unsafe(method(init))]
#[unsafe(method_family = init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
#[cfg(all(feature = "GKAchievementDescription", feature = "block2"))]
/// Loads all associated achievements that have defined deep links to this game activity definition.
#[unsafe(method(loadAchievementDescriptionsWithCompletionHandler:))]
#[unsafe(method_family = none)]
pub unsafe fn loadAchievementDescriptionsWithCompletionHandler(
&self,
completion_handler: &block2::DynBlock<
dyn Fn(*mut NSArray<GKAchievementDescription>, *mut NSError),
>,
);
#[cfg(all(feature = "GKLeaderboard", feature = "block2"))]
/// Loads all associated leaderboards that have defined deep links to this game activity definition.
#[unsafe(method(loadLeaderboardsWithCompletionHandler:))]
#[unsafe(method_family = none)]
pub unsafe fn loadLeaderboardsWithCompletionHandler(
&self,
completion_handler: &block2::DynBlock<
dyn Fn(*mut NSArray<GKLeaderboard>, *mut NSError),
>,
);
#[cfg(all(feature = "block2", feature = "objc2-app-kit"))]
#[cfg(target_os = "macos")]
/// Asynchronously load the image. Error will be nil on success.
#[unsafe(method(loadImageWithCompletionHandler:))]
#[unsafe(method_family = none)]
pub unsafe fn loadImageWithCompletionHandler(
&self,
completion_handler: &block2::DynBlock<dyn Fn(*mut NSImage, *mut NSError)>,
);
);
}
/// Methods declared on superclass `NSObject`.
impl GKGameActivityDefinition {
extern_methods!(
#[unsafe(method(new))]
#[unsafe(method_family = new)]
pub unsafe fn new() -> Retained<Self>;
);
}
/// State.
impl GKGameActivityDefinition {
extern_methods!(
#[cfg(feature = "block2")]
/// Loads all the game activity definitions for the current game.
#[unsafe(method(loadGameActivityDefinitionsWithCompletionHandler:))]
#[unsafe(method_family = none)]
pub unsafe fn loadGameActivityDefinitionsWithCompletionHandler(
completion_handler: &block2::DynBlock<
dyn Fn(*mut NSArray<GKGameActivityDefinition>, *mut NSError),
>,
);
#[cfg(feature = "block2")]
/// Loads game activity definitions with the supplied App Store Connect identifiers.
#[unsafe(method(loadGameActivityDefinitionsWithIDs:completionHandler:))]
#[unsafe(method_family = none)]
pub unsafe fn loadGameActivityDefinitionsWithIDs_completionHandler(
activity_definition_i_ds: Option<&NSArray<NSString>>,
completion_handler: &block2::DynBlock<
dyn Fn(*mut NSArray<GKGameActivityDefinition>, *mut NSError),
>,
);
);
}