objc2-watch-kit 0.3.2

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

/// [Apple's documentation](https://developer.apple.com/documentation/watchkit/wkalertactionstyle?language=objc)
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct WKAlertActionStyle(pub NSInteger);
impl WKAlertActionStyle {
    #[doc(alias = "WKAlertActionStyleDefault")]
    pub const Default: Self = Self(0);
    #[doc(alias = "WKAlertActionStyleCancel")]
    pub const Cancel: Self = Self(1);
    #[doc(alias = "WKAlertActionStyleDestructive")]
    pub const Destructive: Self = Self(2);
}

unsafe impl Encode for WKAlertActionStyle {
    const ENCODING: Encoding = NSInteger::ENCODING;
}

unsafe impl RefEncode for WKAlertActionStyle {
    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}

/// [Apple's documentation](https://developer.apple.com/documentation/watchkit/wkalertactionhandler?language=objc)
#[cfg(feature = "block2")]
pub type WKAlertActionHandler = *mut block2::DynBlock<dyn Fn()>;

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

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

impl WKAlertAction {
    extern_methods!(
        #[cfg(feature = "block2")]
        /// # Safety
        ///
        /// `handler` must be a valid pointer.
        #[unsafe(method(actionWithTitle:style:handler:))]
        #[unsafe(method_family = none)]
        pub unsafe fn actionWithTitle_style_handler(
            title: &NSString,
            style: WKAlertActionStyle,
            handler: WKAlertActionHandler,
        ) -> Retained<Self>;

        #[unsafe(method(init))]
        #[unsafe(method_family = init)]
        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
    );
}

/// Methods declared on superclass `NSObject`.
impl WKAlertAction {
    extern_methods!(
        #[unsafe(method(new))]
        #[unsafe(method_family = new)]
        pub unsafe fn new() -> Retained<Self>;
    );
}