objc2-contacts-ui 0.3.2

Bindings to the ContactsUI 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::*;
#[cfg(feature = "objc2-contacts")]
use objc2_contacts::*;
use objc2_foundation::*;

use crate::*;

extern_class!(
    /// A view controller to display and edit a
    /// `CNContact.`
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/contactsui/cncontactviewcontroller?language=objc)
    #[unsafe(super(NSViewController, NSResponder, NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    #[cfg(feature = "objc2-app-kit")]
    #[cfg(target_os = "macos")]
    pub struct CNContactViewController;
);

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

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

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

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

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

#[cfg(feature = "objc2-app-kit")]
#[cfg(target_os = "macos")]
impl CNContactViewController {
    extern_methods!(
        #[cfg(feature = "objc2-contacts")]
        /// Descriptor for all keys that must be fetched on a contact before setting it on the view controller.
        ///
        /// Pass this descriptor to the keysToFetch of the
        /// `CNContactFetchRequest`if you want to display the contact in a
        /// `CNContactViewController.`
        #[unsafe(method(descriptorForRequiredKeys))]
        #[unsafe(method_family = none)]
        pub unsafe fn descriptorForRequiredKeys(
            mtm: MainThreadMarker,
        ) -> Retained<ProtocolObject<dyn CNKeyDescriptor>>;

        #[cfg(feature = "objc2-contacts")]
        /// A
        /// `contact`to display.
        ///
        /// When
        /// `contact`is nil, displays an empty selection state.
        #[unsafe(method(contact))]
        #[unsafe(method_family = none)]
        pub unsafe fn contact(&self) -> Option<Retained<CNContact>>;

        #[cfg(feature = "objc2-contacts")]
        /// Setter for [`contact`][Self::contact].
        ///
        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
        #[unsafe(method(setContact:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setContact(&self, contact: Option<&CNContact>);
    );
}

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