objc2_game_kit/generated/
GKLeaderboardSet.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    /// GKLeaderboardSet represents the sets that leaderboards can be broken out into.
15    ///
16    /// See also [Apple's documentation](https://developer.apple.com/documentation/gamekit/gkleaderboardset?language=objc)
17    #[unsafe(super(NSObject))]
18    #[derive(Debug, PartialEq, Eq, Hash)]
19    pub struct GKLeaderboardSet;
20);
21
22extern_conformance!(
23    unsafe impl NSCoding for GKLeaderboardSet {}
24);
25
26extern_conformance!(
27    unsafe impl NSObjectProtocol for GKLeaderboardSet {}
28);
29
30extern_conformance!(
31    unsafe impl NSSecureCoding for GKLeaderboardSet {}
32);
33
34impl GKLeaderboardSet {
35    extern_methods!(
36        /// Localized set title.
37        #[unsafe(method(title))]
38        #[unsafe(method_family = none)]
39        pub unsafe fn title(&self) -> Retained<NSString>;
40
41        /// set when leaderboardSets have been designated a game group; set when loadLeaderboardSetsWithCompletionHandler has been called for leaderboards that support game groups
42        #[unsafe(method(groupIdentifier))]
43        #[unsafe(method_family = none)]
44        pub unsafe fn groupIdentifier(&self) -> Option<Retained<NSString>>;
45
46        /// leaderboard set.
47        #[unsafe(method(identifier))]
48        #[unsafe(method_family = none)]
49        pub unsafe fn identifier(&self) -> Option<Retained<NSString>>;
50
51        /// Setter for [`identifier`][Self::identifier].
52        ///
53        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
54        #[unsafe(method(setIdentifier:))]
55        #[unsafe(method_family = none)]
56        pub unsafe fn setIdentifier(&self, identifier: Option<&NSString>);
57
58        #[cfg(feature = "block2")]
59        /// Loads array with all sets for game
60        /// Possible reasons for error:
61        /// 1. Communications problem
62        /// 2. Unauthenticated player
63        /// 3. Set not present
64        #[unsafe(method(loadLeaderboardSetsWithCompletionHandler:))]
65        #[unsafe(method_family = none)]
66        pub unsafe fn loadLeaderboardSetsWithCompletionHandler(
67            completion_handler: Option<
68                &block2::DynBlock<dyn Fn(*mut NSArray<GKLeaderboardSet>, *mut NSError)>,
69            >,
70        );
71
72        #[cfg(all(feature = "GKLeaderboard", feature = "block2"))]
73        /// Loads array with all classic leaderboards and current instances of recurring leaderboards for this leaderboardSet
74        /// Possible reasons for error:
75        /// 1. Communications problem
76        /// 2. Unauthenticated player
77        #[unsafe(method(loadLeaderboardsWithHandler:))]
78        #[unsafe(method_family = none)]
79        pub unsafe fn loadLeaderboardsWithHandler(
80            &self,
81            handler: &block2::DynBlock<dyn Fn(*mut NSArray<GKLeaderboard>, *mut NSError)>,
82        );
83    );
84}
85
86/// Methods declared on superclass `NSObject`.
87impl GKLeaderboardSet {
88    extern_methods!(
89        #[unsafe(method(init))]
90        #[unsafe(method_family = init)]
91        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
92
93        #[unsafe(method(new))]
94        #[unsafe(method_family = new)]
95        pub unsafe fn new() -> Retained<Self>;
96    );
97}
98
99/// Deprecated.
100impl GKLeaderboardSet {
101    extern_methods!(
102        #[cfg(all(feature = "GKLeaderboard", feature = "block2"))]
103        /// Loads array with all leaderboards for the leaderboardSet
104        /// Possible reasons for error:
105        /// 1. Communications problem
106        /// 2. Unauthenticated player
107        #[deprecated]
108        #[unsafe(method(loadLeaderboardsWithCompletionHandler:))]
109        #[unsafe(method_family = none)]
110        pub unsafe fn loadLeaderboardsWithCompletionHandler(
111            &self,
112            completion_handler: Option<
113                &block2::DynBlock<dyn Fn(*mut NSArray<GKLeaderboard>, *mut NSError)>,
114            >,
115        );
116    );
117}
118
119/// UI.
120impl GKLeaderboardSet {
121    extern_methods!(
122        #[cfg(all(feature = "block2", feature = "objc2-app-kit"))]
123        #[cfg(target_os = "macos")]
124        /// Asynchronously load the image. Error will be nil on success.
125        #[unsafe(method(loadImageWithCompletionHandler:))]
126        #[unsafe(method_family = none)]
127        pub unsafe fn loadImageWithCompletionHandler(
128            &self,
129            completion_handler: Option<&block2::DynBlock<dyn Fn(*mut NSImage, *mut NSError)>>,
130        );
131    );
132}