objc2-call-kit 0.3.2

Bindings to the CallKit framework
Documentation
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use core::ffi::*;
use core::ptr::NonNull;
#[cfg(feature = "dispatch2")]
use dispatch2::*;
use objc2::__framework_prelude::*;
use objc2_foundation::*;

use crate::*;

extern_protocol!(
    /// [Apple's documentation](https://developer.apple.com/documentation/callkit/cxcallobserverdelegate?language=objc)
    pub unsafe trait CXCallObserverDelegate: NSObjectProtocol {
        #[cfg(feature = "CXCall")]
        #[unsafe(method(callObserver:callChanged:))]
        #[unsafe(method_family = none)]
        unsafe fn callObserver_callChanged(&self, call_observer: &CXCallObserver, call: &CXCall);
    }
);

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

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

impl CXCallObserver {
    extern_methods!(
        #[cfg(feature = "CXCall")]
        /// Retrieve the current call list, blocking on initial state retrieval if necessary
        #[unsafe(method(calls))]
        #[unsafe(method_family = none)]
        pub unsafe fn calls(&self) -> Retained<NSArray<CXCall>>;

        #[cfg(feature = "dispatch2")]
        /// Set delegate and optional queue for delegate callbacks to be performed on.
        /// A nil queue implies that delegate callbacks should happen on the main queue. The delegate is stored weakly
        ///
        /// # Safety
        ///
        /// `queue` possibly has additional threading requirements.
        #[unsafe(method(setDelegate:queue:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setDelegate_queue(
            &self,
            delegate: Option<&ProtocolObject<dyn CXCallObserverDelegate>>,
            queue: Option<&DispatchQueue>,
        );
    );
}

/// Methods declared on superclass `NSObject`.
impl CXCallObserver {
    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>;
    );
}