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
//! 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/gkchallengedefinition?language=objc)
#[unsafe(super(NSObject))]
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct GKChallengeDefinition;
);
unsafe impl Send for GKChallengeDefinition {}
unsafe impl Sync for GKChallengeDefinition {}
extern_conformance!(
unsafe impl NSObjectProtocol for GKChallengeDefinition {}
);
impl GKChallengeDefinition {
extern_methods!(
/// The developer defined identifier for a given challenge definition.
///
/// 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 challenge definition, 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 challenge definition.
///
/// 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 challenge definition.
///
/// 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>>;
/// The duration options for the challenge, like `1 day` or `1 week`.
/// - Note: If set, the amount of weeks is stored in the `weekOfYear` field.
/// - Important: The actual duration of the challenge may be dynamically adjusted
/// in order to accommodate different factors like players' timezones.
///
/// This property is not atomic.
///
/// # Safety
///
/// This might not be thread-safe.
#[unsafe(method(durationOptions))]
#[unsafe(method_family = none)]
pub unsafe fn durationOptions(&self) -> Retained<NSArray<NSDateComponents>>;
/// Indicates if a challenge can be attempted more than once.
///
/// This property is not atomic.
///
/// # Safety
///
/// This might not be thread-safe.
#[unsafe(method(isRepeatable))]
#[unsafe(method_family = none)]
pub unsafe fn isRepeatable(&self) -> bool;
#[cfg(feature = "GKLeaderboard")]
/// Scores submitted to this leaderboard will also be submitted as scores in this challenge.
///
/// This property is not atomic.
///
/// # Safety
///
/// This might not be thread-safe.
#[unsafe(method(leaderboard))]
#[unsafe(method_family = none)]
pub unsafe fn leaderboard(&self) -> Option<Retained<GKLeaderboard>>;
#[cfg(feature = "GKReleaseState")]
/// The release state of the challenge 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;
#[cfg(all(feature = "block2", feature = "objc2-app-kit"))]
#[cfg(target_os = "macos")]
/// Loads the image set on the challenge definition, which may be `nil` if none was set.
#[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 GKChallengeDefinition {
extern_methods!(
#[unsafe(method(init))]
#[unsafe(method_family = init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
#[unsafe(method(new))]
#[unsafe(method_family = new)]
pub unsafe fn new() -> Retained<Self>;
);
}
/// State.
impl GKChallengeDefinition {
extern_methods!(
#[cfg(feature = "block2")]
/// Loads all the challenge definitions for the current game, returns an empty array if none exist.
/// - Important: Archived challenge definitions are excluded.
#[unsafe(method(loadChallengeDefinitionsWithCompletionHandler:))]
#[unsafe(method_family = none)]
pub unsafe fn loadChallengeDefinitionsWithCompletionHandler(
completion_handler: &block2::DynBlock<
dyn Fn(*mut NSArray<GKChallengeDefinition>, *mut NSError),
>,
);
#[cfg(feature = "block2")]
/// Indicates if this definition has active challenges associated with it.
#[unsafe(method(hasActiveChallengesWithCompletionHandler:))]
#[unsafe(method_family = none)]
pub unsafe fn hasActiveChallengesWithCompletionHandler(
&self,
completion_handler: &block2::DynBlock<dyn Fn(Bool, *mut NSError)>,
);
);
}