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::*;
#[cfg(feature = "objc2-app-kit")]
#[cfg(target_os = "macos")]
use objc2_app_kit::*;
use objc2_foundation::*;

use crate::*;

extern_class!(
    /// [Apple's documentation](https://developer.apple.com/documentation/multipeerconnectivity/mcbrowserviewcontroller?language=objc)
    #[unsafe(super(NSViewController, NSResponder, NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    #[cfg(feature = "objc2-app-kit")]
    #[cfg(target_os = "macos")]
    pub struct MCBrowserViewController;
);

#[cfg(all(feature = "MCNearbyServiceBrowser", feature = "objc2-app-kit"))]
#[cfg(target_os = "macos")]
extern_conformance!(
    unsafe impl MCNearbyServiceBrowserDelegate for MCBrowserViewController {}
);

#[cfg(feature = "objc2-app-kit")]
#[cfg(target_os = "macos")]
extern_conformance!(
    unsafe impl NSCoding for MCBrowserViewController {}
);

#[cfg(feature = "objc2-app-kit")]
#[cfg(target_os = "macos")]
extern_conformance!(
    unsafe impl NSEditor for MCBrowserViewController {}
);

#[cfg(feature = "objc2-app-kit")]
#[cfg(target_os = "macos")]
extern_conformance!(
    unsafe impl NSObjectProtocol for MCBrowserViewController {}
);

#[cfg(feature = "objc2-app-kit")]
#[cfg(target_os = "macos")]
extern_conformance!(
    unsafe impl NSSeguePerforming for MCBrowserViewController {}
);

#[cfg(feature = "objc2-app-kit")]
#[cfg(target_os = "macos")]
extern_conformance!(
    unsafe impl NSUserInterfaceItemIdentification for MCBrowserViewController {}
);

#[cfg(feature = "objc2-app-kit")]
#[cfg(target_os = "macos")]
impl MCBrowserViewController {
    extern_methods!(
        #[cfg(feature = "MCSession")]
        #[unsafe(method(initWithServiceType:session:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithServiceType_session(
            this: Allocated<Self>,
            service_type: &NSString,
            session: &MCSession,
        ) -> Retained<Self>;

        #[cfg(all(feature = "MCNearbyServiceBrowser", feature = "MCSession"))]
        #[unsafe(method(initWithBrowser:session:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithBrowser_session(
            this: Allocated<Self>,
            browser: &MCNearbyServiceBrowser,
            session: &MCSession,
        ) -> Retained<Self>;

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

        /// 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 MCBrowserViewControllerDelegate>>,
        );

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

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

        #[unsafe(method(minimumNumberOfPeers))]
        #[unsafe(method_family = none)]
        pub unsafe fn minimumNumberOfPeers(&self) -> NSUInteger;

        /// Setter for [`minimumNumberOfPeers`][Self::minimumNumberOfPeers].
        #[unsafe(method(setMinimumNumberOfPeers:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setMinimumNumberOfPeers(&self, minimum_number_of_peers: NSUInteger);

        #[unsafe(method(maximumNumberOfPeers))]
        #[unsafe(method_family = none)]
        pub unsafe fn maximumNumberOfPeers(&self) -> NSUInteger;

        /// Setter for [`maximumNumberOfPeers`][Self::maximumNumberOfPeers].
        #[unsafe(method(setMaximumNumberOfPeers:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setMaximumNumberOfPeers(&self, maximum_number_of_peers: NSUInteger);
    );
}

/// Methods declared on superclass `NSViewController`.
#[cfg(feature = "objc2-app-kit")]
#[cfg(target_os = "macos")]
impl MCBrowserViewController {
    extern_methods!(
        #[unsafe(method(initWithNibName:bundle:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithNibName_bundle(
            this: Allocated<Self>,
            nib_name_or_nil: Option<&NSNibName>,
            nib_bundle_or_nil: Option<&NSBundle>,
        ) -> Retained<Self>;

        /// # Safety
        ///
        /// `coder` possibly has further requirements.
        #[unsafe(method(initWithCoder:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithCoder(
            this: Allocated<Self>,
            coder: &NSCoder,
        ) -> Option<Retained<Self>>;
    );
}

/// Methods declared on superclass `NSResponder`.
#[cfg(feature = "objc2-app-kit")]
#[cfg(target_os = "macos")]
impl MCBrowserViewController {
    extern_methods!(
        #[unsafe(method(init))]
        #[unsafe(method_family = init)]
        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
    );
}

/// Methods declared on superclass `NSObject`.
#[cfg(feature = "objc2-app-kit")]
#[cfg(target_os = "macos")]
impl MCBrowserViewController {
    extern_methods!(
        #[unsafe(method(new))]
        #[unsafe(method_family = new)]
        pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
    );
}

extern_protocol!(
    /// [Apple's documentation](https://developer.apple.com/documentation/multipeerconnectivity/mcbrowserviewcontrollerdelegate?language=objc)
    pub unsafe trait MCBrowserViewControllerDelegate: NSObjectProtocol {
        #[cfg(feature = "objc2-app-kit")]
        #[cfg(target_os = "macos")]
        #[unsafe(method(browserViewControllerDidFinish:))]
        #[unsafe(method_family = none)]
        unsafe fn browserViewControllerDidFinish(
            &self,
            browser_view_controller: &MCBrowserViewController,
        );

        #[cfg(feature = "objc2-app-kit")]
        #[cfg(target_os = "macos")]
        #[unsafe(method(browserViewControllerWasCancelled:))]
        #[unsafe(method_family = none)]
        unsafe fn browserViewControllerWasCancelled(
            &self,
            browser_view_controller: &MCBrowserViewController,
        );

        #[cfg(all(feature = "MCPeerID", feature = "objc2-app-kit"))]
        #[cfg(target_os = "macos")]
        #[optional]
        #[unsafe(method(browserViewController:shouldPresentNearbyPeer:withDiscoveryInfo:))]
        #[unsafe(method_family = none)]
        unsafe fn browserViewController_shouldPresentNearbyPeer_withDiscoveryInfo(
            &self,
            browser_view_controller: &MCBrowserViewController,
            peer_id: &MCPeerID,
            info: Option<&NSDictionary<NSString, NSString>>,
        ) -> bool;
    }
);