use core::ffi::*;
use core::ptr::NonNull;
use objc2::__framework_prelude::*;
use objc2_foundation::*;
use crate::*;
extern_class!(
#[unsafe(super(NSObject))]
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct GKSavedGame;
);
extern_conformance!(
unsafe impl NSCopying for GKSavedGame {}
);
unsafe impl CopyingHelper for GKSavedGame {
type Result = Self;
}
extern_conformance!(
unsafe impl NSObjectProtocol for GKSavedGame {}
);
impl GKSavedGame {
extern_methods!(
#[unsafe(method(name))]
#[unsafe(method_family = none)]
pub unsafe fn name(&self) -> Option<Retained<NSString>>;
#[unsafe(method(deviceName))]
#[unsafe(method_family = none)]
pub unsafe fn deviceName(&self) -> Option<Retained<NSString>>;
#[unsafe(method(modificationDate))]
#[unsafe(method_family = none)]
pub unsafe fn modificationDate(&self) -> Option<Retained<NSDate>>;
#[cfg(feature = "block2")]
#[unsafe(method(loadDataWithCompletionHandler:))]
#[unsafe(method_family = none)]
pub unsafe fn loadDataWithCompletionHandler(
&self,
handler: Option<&block2::DynBlock<dyn Fn(*mut NSData, *mut NSError)>>,
);
);
}
impl GKSavedGame {
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>;
);
}
#[cfg(all(
feature = "GKBasePlayer",
feature = "GKLocalPlayer",
feature = "GKPlayer"
))]
impl GKLocalPlayer {
extern_methods!(
#[cfg(feature = "block2")]
#[unsafe(method(fetchSavedGamesWithCompletionHandler:))]
#[unsafe(method_family = none)]
pub unsafe fn fetchSavedGamesWithCompletionHandler(
&self,
handler: Option<&block2::DynBlock<dyn Fn(*mut NSArray<GKSavedGame>, *mut NSError)>>,
);
#[cfg(feature = "block2")]
#[unsafe(method(saveGameData:withName:completionHandler:))]
#[unsafe(method_family = none)]
pub unsafe fn saveGameData_withName_completionHandler(
&self,
data: &NSData,
name: &NSString,
handler: Option<&block2::DynBlock<dyn Fn(*mut GKSavedGame, *mut NSError)>>,
);
#[cfg(feature = "block2")]
#[unsafe(method(deleteSavedGamesWithName:completionHandler:))]
#[unsafe(method_family = none)]
pub unsafe fn deleteSavedGamesWithName_completionHandler(
&self,
name: &NSString,
handler: Option<&block2::DynBlock<dyn Fn(*mut NSError)>>,
);
#[cfg(feature = "block2")]
#[unsafe(method(resolveConflictingSavedGames:withData:completionHandler:))]
#[unsafe(method_family = none)]
pub unsafe fn resolveConflictingSavedGames_withData_completionHandler(
&self,
conflicting_saved_games: &NSArray<GKSavedGame>,
data: &NSData,
handler: Option<&block2::DynBlock<dyn Fn(*mut NSArray<GKSavedGame>, *mut NSError)>>,
);
);
}
#[cfg(all(
feature = "GKBasePlayer",
feature = "GKLocalPlayer",
feature = "GKPlayer",
feature = "GKSavedGameListener"
))]
extern_conformance!(
unsafe impl GKSavedGameListener for GKLocalPlayer {}
);