objc2-multipeer-connectivity 0.3.2

Bindings to the MultipeerConnectivity 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 objc2_foundation::*;

use crate::*;

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

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

impl MCAdvertiserAssistant {
    extern_methods!(
        #[cfg(feature = "MCSession")]
        #[unsafe(method(initWithServiceType:discoveryInfo:session:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithServiceType_discoveryInfo_session(
            this: Allocated<Self>,
            service_type: &NSString,
            info: Option<&NSDictionary<NSString, NSString>>,
            session: &MCSession,
        ) -> Retained<Self>;

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

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

        #[unsafe(method(delegate))]
        #[unsafe(method_family = none)]
        pub unsafe fn delegate(
            &self,
        ) -> Option<Retained<ProtocolObject<dyn MCAdvertiserAssistantDelegate>>>;

        /// Setter for [`delegate`][Self::delegate].
        ///
        /// This is a [weak property][objc2::topics::weak_property].
        #[unsafe(method(setDelegate:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setDelegate(
            &self,
            delegate: Option<&ProtocolObject<dyn MCAdvertiserAssistantDelegate>>,
        );

        #[cfg(feature = "MCSession")]
        #[unsafe(method(session))]
        #[unsafe(method_family = none)]
        pub unsafe fn session(&self) -> Retained<MCSession>;

        #[unsafe(method(discoveryInfo))]
        #[unsafe(method_family = none)]
        pub unsafe fn discoveryInfo(&self) -> Option<Retained<NSDictionary<NSString, NSString>>>;

        #[unsafe(method(serviceType))]
        #[unsafe(method_family = none)]
        pub unsafe fn serviceType(&self) -> Retained<NSString>;
    );
}

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

extern_protocol!(
    /// [Apple's documentation](https://developer.apple.com/documentation/multipeerconnectivity/mcadvertiserassistantdelegate?language=objc)
    pub unsafe trait MCAdvertiserAssistantDelegate: NSObjectProtocol {
        #[optional]
        #[unsafe(method(advertiserAssistantWillPresentInvitation:))]
        #[unsafe(method_family = none)]
        unsafe fn advertiserAssistantWillPresentInvitation(
            &self,
            advertiser_assistant: &MCAdvertiserAssistant,
        );

        #[optional]
        #[unsafe(method(advertiserAssistantDidDismissInvitation:))]
        #[unsafe(method_family = none)]
        unsafe fn advertiserAssistantDidDismissInvitation(
            &self,
            advertiser_assistant: &MCAdvertiserAssistant,
        );
    }
);