objc2-web-kit 0.3.1

Bindings to the WebKit framework
Documentation
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use core::ptr::NonNull;
use objc2::__framework_prelude::*;
use objc2_foundation::*;

use crate::*;

extern_class!(
    /// A WKScriptMessage object contains information about a message sent from
    /// a webpage.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/webkit/wkscriptmessage?language=objc)
    #[unsafe(super(NSObject))]
    #[thread_kind = MainThreadOnly]
    #[derive(Debug, PartialEq, Eq, Hash)]
    pub struct WKScriptMessage;
);

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

impl WKScriptMessage {
    extern_methods!(
        /// The body of the message.
        ///
        /// Allowed types are NSNumber, NSString, NSDate, NSArray,
        /// NSDictionary, and NSNull.
        #[unsafe(method(body))]
        #[unsafe(method_family = none)]
        pub unsafe fn body(&self) -> Retained<AnyObject>;

        #[cfg(all(feature = "WKWebView", feature = "objc2-app-kit"))]
        #[cfg(target_os = "macos")]
        /// The web view sending the message.
        #[unsafe(method(webView))]
        #[unsafe(method_family = none)]
        pub unsafe fn webView(&self) -> Option<Retained<WKWebView>>;

        #[cfg(feature = "WKFrameInfo")]
        /// The frame sending the message.
        #[unsafe(method(frameInfo))]
        #[unsafe(method_family = none)]
        pub unsafe fn frameInfo(&self) -> Retained<WKFrameInfo>;

        /// The name of the message handler to which the message is sent.
        #[unsafe(method(name))]
        #[unsafe(method_family = none)]
        pub unsafe fn name(&self) -> Retained<NSString>;

        #[cfg(feature = "WKContentWorld")]
        /// The content world from which the message was sent.
        #[unsafe(method(world))]
        #[unsafe(method_family = none)]
        pub unsafe fn world(&self) -> Retained<WKContentWorld>;
    );
}

/// Methods declared on superclass `NSObject`.
impl WKScriptMessage {
    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(mtm: MainThreadMarker) -> Retained<Self>;
    );
}