objc2-user-notifications 0.3.2

Bindings to the UserNotifications framework
Documentation
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use core::ffi::*;
use core::ptr::NonNull;
use objc2::__framework_prelude::*;

use crate::*;

extern_class!(
    /// [Apple's documentation](https://developer.apple.com/documentation/usernotifications/unnotificationserviceextension?language=objc)
    #[unsafe(super(NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    pub struct UNNotificationServiceExtension;
);

extern_conformance!(
    unsafe impl NSObjectProtocol for UNNotificationServiceExtension {}
);

impl UNNotificationServiceExtension {
    extern_methods!(
        #[cfg(all(
            feature = "UNNotificationContent",
            feature = "UNNotificationRequest",
            feature = "block2"
        ))]
        #[unsafe(method(didReceiveNotificationRequest:withContentHandler:))]
        #[unsafe(method_family = none)]
        pub fn didReceiveNotificationRequest_withContentHandler(
            &self,
            request: &UNNotificationRequest,
            content_handler: &block2::DynBlock<dyn Fn(NonNull<UNNotificationContent>)>,
        );

        #[unsafe(method(serviceExtensionTimeWillExpire))]
        #[unsafe(method_family = none)]
        pub fn serviceExtensionTimeWillExpire(&self);
    );
}

/// Methods declared on superclass `NSObject`.
impl UNNotificationServiceExtension {
    extern_methods!(
        #[unsafe(method(init))]
        #[unsafe(method_family = init)]
        pub fn init(this: Allocated<Self>) -> Retained<Self>;

        #[unsafe(method(new))]
        #[unsafe(method_family = new)]
        pub fn new() -> Retained<Self>;
    );
}

impl DefaultRetained for UNNotificationServiceExtension {
    #[inline]
    fn default_retained() -> Retained<Self> {
        Self::new()
    }
}