objc2_game_kit/generated/GKGameActivityDefinition.rs
1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use core::ffi::*;
4use core::ptr::NonNull;
5use objc2::__framework_prelude::*;
6#[cfg(feature = "objc2-app-kit")]
7#[cfg(target_os = "macos")]
8use objc2_app_kit::*;
9use objc2_foundation::*;
10
11use crate::*;
12
13extern_class!(
14 /// [Apple's documentation](https://developer.apple.com/documentation/gamekit/gkgameactivitydefinition?language=objc)
15 #[unsafe(super(NSObject))]
16 #[derive(Debug, PartialEq, Eq, Hash)]
17 pub struct GKGameActivityDefinition;
18);
19
20unsafe impl Send for GKGameActivityDefinition {}
21
22unsafe impl Sync for GKGameActivityDefinition {}
23
24extern_conformance!(
25 unsafe impl NSObjectProtocol for GKGameActivityDefinition {}
26);
27
28impl GKGameActivityDefinition {
29 extern_methods!(
30 /// The developer defined identifier for a given game activity.
31 ///
32 /// This property is not atomic.
33 ///
34 /// # Safety
35 ///
36 /// This might not be thread-safe.
37 #[unsafe(method(identifier))]
38 #[unsafe(method_family = none)]
39 pub unsafe fn identifier(&self) -> Retained<NSString>;
40
41 /// The group identifier for the activity, if one exists.
42 ///
43 /// This property is not atomic.
44 ///
45 /// # Safety
46 ///
47 /// This might not be thread-safe.
48 #[unsafe(method(groupIdentifier))]
49 #[unsafe(method_family = none)]
50 pub unsafe fn groupIdentifier(&self) -> Option<Retained<NSString>>;
51
52 /// A short title for the game activity.
53 ///
54 /// This property is not atomic.
55 ///
56 /// # Safety
57 ///
58 /// This might not be thread-safe.
59 #[unsafe(method(title))]
60 #[unsafe(method_family = none)]
61 pub unsafe fn title(&self) -> Retained<NSString>;
62
63 /// A more detailed description of the game activity.
64 ///
65 /// This property is not atomic.
66 ///
67 /// # Safety
68 ///
69 /// This might not be thread-safe.
70 #[unsafe(method(details))]
71 #[unsafe(method_family = none)]
72 pub unsafe fn details(&self) -> Option<Retained<NSString>>;
73
74 /// Default properties defined by the developer for this type of game activity.
75 ///
76 /// This property is not atomic.
77 ///
78 /// # Safety
79 ///
80 /// This might not be thread-safe.
81 #[unsafe(method(defaultProperties))]
82 #[unsafe(method_family = none)]
83 pub unsafe fn defaultProperties(&self) -> Retained<NSDictionary<NSString, NSString>>;
84
85 /// 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.
86 ///
87 /// This property is not atomic.
88 ///
89 /// # Safety
90 ///
91 /// This might not be thread-safe.
92 #[unsafe(method(fallbackURL))]
93 #[unsafe(method_family = none)]
94 pub unsafe fn fallbackURL(&self) -> Option<Retained<NSURL>>;
95
96 /// Whether the activity can be joined by others via a party code.
97 /// - SeeAlso: ``-[GKGameActivityListener player:wantsToPlayGameActivity:completionHandler:]`` where you can receive and handle game activities that players want to play in a party with friends.
98 ///
99 /// This property is not atomic.
100 ///
101 /// # Safety
102 ///
103 /// This might not be thread-safe.
104 #[unsafe(method(supportsPartyCode))]
105 #[unsafe(method_family = none)]
106 pub unsafe fn supportsPartyCode(&self) -> bool;
107
108 /// 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`.
109 ///
110 /// This property is not atomic.
111 ///
112 /// # Safety
113 ///
114 /// This might not be thread-safe.
115 #[unsafe(method(maxPlayers))]
116 #[unsafe(method_family = none)]
117 pub unsafe fn maxPlayers(&self) -> Option<Retained<NSNumber>>;
118
119 /// The minimum number of participants that can join the activity.
120 ///
121 /// This property is not atomic.
122 ///
123 /// # Safety
124 ///
125 /// This might not be thread-safe.
126 #[unsafe(method(minPlayers))]
127 #[unsafe(method_family = none)]
128 pub unsafe fn minPlayers(&self) -> Option<Retained<NSNumber>>;
129
130 /// 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.
131 ///
132 /// This property is not atomic.
133 ///
134 /// # Safety
135 ///
136 /// This might not be thread-safe.
137 #[unsafe(method(supportsUnlimitedPlayers))]
138 #[unsafe(method_family = none)]
139 pub unsafe fn supportsUnlimitedPlayers(&self) -> bool;
140
141 #[cfg(feature = "GKGameActivityPlayStyle")]
142 /// The play style of the game activity.
143 ///
144 /// This property is not atomic.
145 ///
146 /// # Safety
147 ///
148 /// This might not be thread-safe.
149 #[unsafe(method(playStyle))]
150 #[unsafe(method_family = none)]
151 pub unsafe fn playStyle(&self) -> GKGameActivityPlayStyle;
152
153 #[cfg(feature = "GKReleaseState")]
154 /// The release state of the game activity definition in App Store Connect.
155 ///
156 /// This property is not atomic.
157 ///
158 /// # Safety
159 ///
160 /// This might not be thread-safe.
161 #[unsafe(method(releaseState))]
162 #[unsafe(method_family = none)]
163 pub unsafe fn releaseState(&self) -> GKReleaseState;
164
165 #[unsafe(method(init))]
166 #[unsafe(method_family = init)]
167 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
168
169 #[cfg(all(feature = "GKAchievementDescription", feature = "block2"))]
170 /// Loads all associated achievements that have defined deep links to this game activity definition.
171 #[unsafe(method(loadAchievementDescriptionsWithCompletionHandler:))]
172 #[unsafe(method_family = none)]
173 pub unsafe fn loadAchievementDescriptionsWithCompletionHandler(
174 &self,
175 completion_handler: &block2::DynBlock<
176 dyn Fn(*mut NSArray<GKAchievementDescription>, *mut NSError),
177 >,
178 );
179
180 #[cfg(all(feature = "GKLeaderboard", feature = "block2"))]
181 /// Loads all associated leaderboards that have defined deep links to this game activity definition.
182 #[unsafe(method(loadLeaderboardsWithCompletionHandler:))]
183 #[unsafe(method_family = none)]
184 pub unsafe fn loadLeaderboardsWithCompletionHandler(
185 &self,
186 completion_handler: &block2::DynBlock<
187 dyn Fn(*mut NSArray<GKLeaderboard>, *mut NSError),
188 >,
189 );
190
191 #[cfg(all(feature = "block2", feature = "objc2-app-kit"))]
192 #[cfg(target_os = "macos")]
193 /// Asynchronously load the image. Error will be nil on success.
194 #[unsafe(method(loadImageWithCompletionHandler:))]
195 #[unsafe(method_family = none)]
196 pub unsafe fn loadImageWithCompletionHandler(
197 &self,
198 completion_handler: &block2::DynBlock<dyn Fn(*mut NSImage, *mut NSError)>,
199 );
200 );
201}
202
203/// Methods declared on superclass `NSObject`.
204impl GKGameActivityDefinition {
205 extern_methods!(
206 #[unsafe(method(new))]
207 #[unsafe(method_family = new)]
208 pub unsafe fn new() -> Retained<Self>;
209 );
210}
211
212/// State.
213impl GKGameActivityDefinition {
214 extern_methods!(
215 #[cfg(feature = "block2")]
216 /// Loads all the game activity definitions for the current game.
217 #[unsafe(method(loadGameActivityDefinitionsWithCompletionHandler:))]
218 #[unsafe(method_family = none)]
219 pub unsafe fn loadGameActivityDefinitionsWithCompletionHandler(
220 completion_handler: &block2::DynBlock<
221 dyn Fn(*mut NSArray<GKGameActivityDefinition>, *mut NSError),
222 >,
223 );
224
225 #[cfg(feature = "block2")]
226 /// Loads game activity definitions with the supplied App Store Connect identifiers.
227 #[unsafe(method(loadGameActivityDefinitionsWithIDs:completionHandler:))]
228 #[unsafe(method_family = none)]
229 pub unsafe fn loadGameActivityDefinitionsWithIDs_completionHandler(
230 activity_definition_i_ds: Option<&NSArray<NSString>>,
231 completion_handler: &block2::DynBlock<
232 dyn Fn(*mut NSArray<GKGameActivityDefinition>, *mut NSError),
233 >,
234 );
235 );
236}