objc2_game_kit/generated/
GKAchievementDescription.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    /// GKAchievementDescription is a full description of the achievement as defined before app submission in App Store Connect.
15    ///
16    /// See also [Apple's documentation](https://developer.apple.com/documentation/gamekit/gkachievementdescription?language=objc)
17    #[unsafe(super(NSObject))]
18    #[derive(Debug, PartialEq, Eq, Hash)]
19    pub struct GKAchievementDescription;
20);
21
22extern_conformance!(
23    unsafe impl NSCoding for GKAchievementDescription {}
24);
25
26extern_conformance!(
27    unsafe impl NSObjectProtocol for GKAchievementDescription {}
28);
29
30extern_conformance!(
31    unsafe impl NSSecureCoding for GKAchievementDescription {}
32);
33
34impl GKAchievementDescription {
35    extern_methods!(
36        #[cfg(feature = "block2")]
37        /// Asynchronously load all achievement descriptions
38        #[unsafe(method(loadAchievementDescriptionsWithCompletionHandler:))]
39        #[unsafe(method_family = none)]
40        pub unsafe fn loadAchievementDescriptionsWithCompletionHandler(
41            completion_handler: Option<
42                &block2::DynBlock<dyn Fn(*mut NSArray<GKAchievementDescription>, *mut NSError)>,
43            >,
44        );
45
46        #[unsafe(method(identifier))]
47        #[unsafe(method_family = none)]
48        pub unsafe fn identifier(&self) -> Retained<NSString>;
49
50        /// The group identifier for the achievement, if one exists.
51        #[unsafe(method(groupIdentifier))]
52        #[unsafe(method_family = none)]
53        pub unsafe fn groupIdentifier(&self) -> Option<Retained<NSString>>;
54
55        /// The title of the achievement.
56        #[unsafe(method(title))]
57        #[unsafe(method_family = none)]
58        pub unsafe fn title(&self) -> Retained<NSString>;
59
60        /// The description for an unachieved achievement.
61        #[unsafe(method(achievedDescription))]
62        #[unsafe(method_family = none)]
63        pub unsafe fn achievedDescription(&self) -> Retained<NSString>;
64
65        /// The description for an achieved achievement.
66        #[unsafe(method(unachievedDescription))]
67        #[unsafe(method_family = none)]
68        pub unsafe fn unachievedDescription(&self) -> Retained<NSString>;
69
70        /// Maximum points available for completing this achievement.
71        #[unsafe(method(maximumPoints))]
72        #[unsafe(method_family = none)]
73        pub unsafe fn maximumPoints(&self) -> NSInteger;
74
75        /// Whether or not the achievement should be listed or displayed if not yet unhidden by the game.
76        #[unsafe(method(isHidden))]
77        #[unsafe(method_family = none)]
78        pub unsafe fn isHidden(&self) -> bool;
79
80        /// Whether or not the achievement will be reported by the game when the user earns it again. This allows the achievement to be used for challenges when the recipient has previously earned it.
81        #[unsafe(method(isReplayable))]
82        #[unsafe(method_family = none)]
83        pub unsafe fn isReplayable(&self) -> bool;
84
85        /// If present, the rarity of the achievement expressed as a percentage of players that earned it. Null if not enough data is available to compute it.
86        #[unsafe(method(rarityPercent))]
87        #[unsafe(method_family = none)]
88        pub unsafe fn rarityPercent(&self) -> Option<Retained<NSNumber>>;
89
90        #[cfg(feature = "GKReleaseState")]
91        /// The release state of the achievement in App Store Connect.
92        #[unsafe(method(releaseState))]
93        #[unsafe(method_family = none)]
94        pub unsafe fn releaseState(&self) -> GKReleaseState;
95
96        /// The identifier of the game activity associated with this achievement, as configured by the developer in App Store Connect.
97        #[unsafe(method(activityIdentifier))]
98        #[unsafe(method_family = none)]
99        pub unsafe fn activityIdentifier(&self) -> Retained<NSString>;
100
101        /// The properties when associating this achievement with a game activity, as configured by the developer in App Store Connect.
102        #[unsafe(method(activityProperties))]
103        #[unsafe(method_family = none)]
104        pub unsafe fn activityProperties(&self) -> Retained<NSDictionary<NSString, NSString>>;
105    );
106}
107
108/// Methods declared on superclass `NSObject`.
109impl GKAchievementDescription {
110    extern_methods!(
111        #[unsafe(method(init))]
112        #[unsafe(method_family = init)]
113        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
114
115        #[unsafe(method(new))]
116        #[unsafe(method_family = new)]
117        pub unsafe fn new() -> Retained<Self>;
118    );
119}
120
121/// UI.
122impl GKAchievementDescription {
123    extern_methods!(
124        #[cfg(feature = "objc2-app-kit")]
125        #[cfg(target_os = "macos")]
126        #[deprecated]
127        #[unsafe(method(image))]
128        #[unsafe(method_family = none)]
129        pub unsafe fn image(&self) -> Option<Retained<NSImage>>;
130
131        #[cfg(all(feature = "block2", feature = "objc2-app-kit"))]
132        #[cfg(target_os = "macos")]
133        #[unsafe(method(loadImageWithCompletionHandler:))]
134        #[unsafe(method_family = none)]
135        pub unsafe fn loadImageWithCompletionHandler(
136            &self,
137            completion_handler: Option<&block2::DynBlock<dyn Fn(*mut NSImage, *mut NSError)>>,
138        );
139
140        #[cfg(feature = "objc2-app-kit")]
141        #[cfg(target_os = "macos")]
142        #[unsafe(method(incompleteAchievementImage))]
143        #[unsafe(method_family = none)]
144        pub unsafe fn incompleteAchievementImage() -> Retained<NSImage>;
145
146        #[cfg(feature = "objc2-app-kit")]
147        #[cfg(target_os = "macos")]
148        #[unsafe(method(placeholderCompletedAchievementImage))]
149        #[unsafe(method_family = none)]
150        pub unsafe fn placeholderCompletedAchievementImage() -> Retained<NSImage>;
151    );
152}