objc2_game_kit/generated/
GKScore.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::*;
6use objc2_foundation::*;
7
8use crate::*;
9
10extern_class!(
11    /// GKScore represents a score in the leaderboards.
12    ///
13    /// See also [Apple's documentation](https://developer.apple.com/documentation/gamekit/gkscore?language=objc)
14    #[unsafe(super(NSObject))]
15    #[derive(Debug, PartialEq, Eq, Hash)]
16    #[deprecated]
17    pub struct GKScore;
18);
19
20extern_conformance!(
21    unsafe impl NSCoding for GKScore {}
22);
23
24extern_conformance!(
25    unsafe impl NSObjectProtocol for GKScore {}
26);
27
28extern_conformance!(
29    unsafe impl NSSecureCoding for GKScore {}
30);
31
32impl GKScore {
33    extern_methods!(
34        /// Initialize the score with the local player and current date.
35        #[deprecated]
36        #[unsafe(method(initWithLeaderboardIdentifier:))]
37        #[unsafe(method_family = init)]
38        pub unsafe fn initWithLeaderboardIdentifier(
39            this: Allocated<Self>,
40            identifier: &NSString,
41        ) -> Retained<Self>;
42
43        #[cfg(all(feature = "GKBasePlayer", feature = "GKPlayer"))]
44        /// Initialize the achievement for a specific player. Use to submit participant scores when ending a turn-based match.
45        #[deprecated]
46        #[unsafe(method(initWithLeaderboardIdentifier:player:))]
47        #[unsafe(method_family = init)]
48        pub unsafe fn initWithLeaderboardIdentifier_player(
49            this: Allocated<Self>,
50            identifier: &NSString,
51            player: &GKPlayer,
52        ) -> Retained<Self>;
53
54        /// The score value as a 64bit integer.
55        #[deprecated]
56        #[unsafe(method(value))]
57        #[unsafe(method_family = none)]
58        pub unsafe fn value(&self) -> i64;
59
60        /// Setter for [`value`][Self::value].
61        #[deprecated]
62        #[unsafe(method(setValue:))]
63        #[unsafe(method_family = none)]
64        pub unsafe fn setValue(&self, value: i64);
65
66        /// The score formatted as a string, localized with a label
67        #[deprecated]
68        #[unsafe(method(formattedValue))]
69        #[unsafe(method_family = none)]
70        pub unsafe fn formattedValue(&self) -> Option<Retained<NSString>>;
71
72        /// leaderboard identifier (required)
73        #[deprecated]
74        #[unsafe(method(leaderboardIdentifier))]
75        #[unsafe(method_family = none)]
76        pub unsafe fn leaderboardIdentifier(&self) -> Retained<NSString>;
77
78        /// Setter for [`leaderboardIdentifier`][Self::leaderboardIdentifier].
79        ///
80        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
81        #[deprecated]
82        #[unsafe(method(setLeaderboardIdentifier:))]
83        #[unsafe(method_family = none)]
84        pub unsafe fn setLeaderboardIdentifier(&self, leaderboard_identifier: &NSString);
85
86        /// optional additional context that allows a game to store and retrieve additional data associated with the store.  Default value of zero is returned if no value is set.
87        #[deprecated]
88        #[unsafe(method(context))]
89        #[unsafe(method_family = none)]
90        pub unsafe fn context(&self) -> u64;
91
92        /// Setter for [`context`][Self::context].
93        #[deprecated]
94        #[unsafe(method(setContext:))]
95        #[unsafe(method_family = none)]
96        pub unsafe fn setContext(&self, context: u64);
97
98        /// The date this score was recorded. A newly initialized, unsubmitted GKScore records the current date at init time.
99        #[deprecated]
100        #[unsafe(method(date))]
101        #[unsafe(method_family = none)]
102        pub unsafe fn date(&self) -> Retained<NSDate>;
103
104        #[cfg(all(feature = "GKBasePlayer", feature = "GKPlayer"))]
105        /// The player that recorded the score.
106        #[deprecated]
107        #[unsafe(method(player))]
108        #[unsafe(method_family = none)]
109        pub unsafe fn player(&self) -> Retained<GKPlayer>;
110
111        /// The rank of the player within the leaderboard, only valid when returned from GKLeaderboard
112        #[deprecated]
113        #[unsafe(method(rank))]
114        #[unsafe(method_family = none)]
115        pub unsafe fn rank(&self) -> NSInteger;
116
117        /// Convenience property to make the leaderboard associated with this GKScore, the default leaderboard for this player. Default value is false.
118        /// If true, reporting that score will make the category this score belongs to, the default leaderboard for this user
119        #[deprecated]
120        #[unsafe(method(shouldSetDefaultLeaderboard))]
121        #[unsafe(method_family = none)]
122        pub unsafe fn shouldSetDefaultLeaderboard(&self) -> bool;
123
124        /// Setter for [`shouldSetDefaultLeaderboard`][Self::shouldSetDefaultLeaderboard].
125        #[deprecated]
126        #[unsafe(method(setShouldSetDefaultLeaderboard:))]
127        #[unsafe(method_family = none)]
128        pub unsafe fn setShouldSetDefaultLeaderboard(&self, should_set_default_leaderboard: bool);
129
130        #[cfg(feature = "block2")]
131        /// Report scores to the server. The value must be set, and date may be changed.
132        /// Possible reasons for error:
133        /// 1. Value not set
134        /// 2. Local player not authenticated
135        /// 3. Communications problem
136        #[deprecated]
137        #[unsafe(method(reportScores:withCompletionHandler:))]
138        #[unsafe(method_family = none)]
139        pub unsafe fn reportScores_withCompletionHandler(
140            scores: &NSArray<GKScore>,
141            completion_handler: Option<&block2::DynBlock<dyn Fn(*mut NSError)>>,
142        );
143    );
144}
145
146/// Methods declared on superclass `NSObject`.
147impl GKScore {
148    extern_methods!(
149        #[unsafe(method(init))]
150        #[unsafe(method_family = init)]
151        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
152
153        #[unsafe(method(new))]
154        #[unsafe(method_family = new)]
155        pub unsafe fn new() -> Retained<Self>;
156    );
157}
158
159/// Deprecated.
160#[deprecated]
161impl GKScore {
162    extern_methods!(
163        #[cfg(feature = "block2")]
164        #[deprecated]
165        #[unsafe(method(reportScoreWithCompletionHandler:))]
166        #[unsafe(method_family = none)]
167        pub unsafe fn reportScoreWithCompletionHandler(
168            &self,
169            completion_handler: Option<&block2::DynBlock<dyn Fn(*mut NSError)>>,
170        );
171
172        #[deprecated]
173        #[unsafe(method(initWithCategory:))]
174        #[unsafe(method_family = init)]
175        pub unsafe fn initWithCategory(
176            this: Allocated<Self>,
177            category: Option<&NSString>,
178        ) -> Retained<Self>;
179
180        #[deprecated]
181        #[unsafe(method(category))]
182        #[unsafe(method_family = none)]
183        pub unsafe fn category(&self) -> Option<Retained<NSString>>;
184
185        /// Setter for [`category`][Self::category].
186        ///
187        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
188        #[deprecated]
189        #[unsafe(method(setCategory:))]
190        #[unsafe(method_family = none)]
191        pub unsafe fn setCategory(&self, category: Option<&NSString>);
192    );
193}
194
195/// Obsoleted.
196impl GKScore {
197    extern_methods!(
198        /// * This method is obsolete. Calling this initialiser does nothing and will return nil **
199        #[deprecated]
200        #[unsafe(method(initWithLeaderboardIdentifier:forPlayer:))]
201        #[unsafe(method_family = init)]
202        pub unsafe fn initWithLeaderboardIdentifier_forPlayer(
203            this: Allocated<Self>,
204            identifier: &NSString,
205            player_id: &NSString,
206        ) -> Option<Retained<Self>>;
207
208        /// * This property is obsolete. **
209        #[deprecated]
210        #[unsafe(method(playerID))]
211        #[unsafe(method_family = none)]
212        pub unsafe fn playerID(&self) -> Option<Retained<NSString>>;
213    );
214}