icrate 0.1.2

Bindings to Apple's frameworks
Documentation
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use crate::common::*;
use crate::BackgroundTasks::*;
use crate::Foundation::*;

extern_static!(BGTaskSchedulerErrorDomain: &'static NSErrorDomain);

ns_error_enum!(
    #[underlying(NSInteger)]
    pub enum BGTaskSchedulerErrorCode {
        BGTaskSchedulerErrorCodeUnavailable = 1,
        BGTaskSchedulerErrorCodeTooManyPendingTaskRequests = 2,
        BGTaskSchedulerErrorCodeNotPermitted = 3,
    }
);

extern_class!(
    #[derive(Debug, PartialEq, Eq, Hash)]
    #[cfg(feature = "BackgroundTasks_BGTaskScheduler")]
    pub struct BGTaskScheduler;

    #[cfg(feature = "BackgroundTasks_BGTaskScheduler")]
    unsafe impl ClassType for BGTaskScheduler {
        type Super = NSObject;
        type Mutability = InteriorMutable;
    }
);

#[cfg(feature = "BackgroundTasks_BGTaskScheduler")]
unsafe impl NSObjectProtocol for BGTaskScheduler {}

extern_methods!(
    #[cfg(feature = "BackgroundTasks_BGTaskScheduler")]
    unsafe impl BGTaskScheduler {
        #[method_id(@__retain_semantics Init init)]
        pub unsafe fn init(this: Allocated<Self>) -> Id<Self>;

        #[method_id(@__retain_semantics New new)]
        pub unsafe fn new() -> Id<Self>;

        #[method_id(@__retain_semantics Other sharedScheduler)]
        pub unsafe fn sharedScheduler() -> Id<BGTaskScheduler>;

        #[cfg(all(
            feature = "BackgroundTasks_BGTaskRequest",
            feature = "Foundation_NSError"
        ))]
        #[method(submitTaskRequest:error:_)]
        pub unsafe fn submitTaskRequest_error(
            &self,
            task_request: &BGTaskRequest,
        ) -> Result<(), Id<NSError>>;

        #[cfg(feature = "Foundation_NSString")]
        #[method(cancelTaskRequestWithIdentifier:)]
        pub unsafe fn cancelTaskRequestWithIdentifier(&self, identifier: &NSString);

        #[method(cancelAllTaskRequests)]
        pub unsafe fn cancelAllTaskRequests(&self);

        #[cfg(all(
            feature = "BackgroundTasks_BGTaskRequest",
            feature = "Foundation_NSArray"
        ))]
        #[method(getPendingTaskRequestsWithCompletionHandler:)]
        pub unsafe fn getPendingTaskRequestsWithCompletionHandler(
            &self,
            completion_handler: &Block<(NonNull<NSArray<BGTaskRequest>>,), ()>,
        );
    }
);