objc2-gameplay-kit 0.3.2

Bindings to the GameplayKit 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::*;
#[cfg(feature = "objc2-sprite-kit")]
use objc2_sprite_kit::*;

use crate::*;

extern_class!(
    /// A component that encapsulates a SpriteKit node.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/gameplaykit/gksknodecomponent?language=objc)
    #[unsafe(super(GKComponent, NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    #[cfg(feature = "GKComponent")]
    pub struct GKSKNodeComponent;
);

#[cfg(all(feature = "GKAgent", feature = "GKComponent"))]
extern_conformance!(
    unsafe impl GKAgentDelegate for GKSKNodeComponent {}
);

#[cfg(feature = "GKComponent")]
extern_conformance!(
    unsafe impl NSCoding for GKSKNodeComponent {}
);

#[cfg(feature = "GKComponent")]
extern_conformance!(
    unsafe impl NSCopying for GKSKNodeComponent {}
);

#[cfg(feature = "GKComponent")]
unsafe impl CopyingHelper for GKSKNodeComponent {
    type Result = Self;
}

#[cfg(feature = "GKComponent")]
extern_conformance!(
    unsafe impl NSObjectProtocol for GKSKNodeComponent {}
);

#[cfg(feature = "GKComponent")]
extern_conformance!(
    unsafe impl NSSecureCoding for GKSKNodeComponent {}
);

#[cfg(feature = "GKComponent")]
impl GKSKNodeComponent {
    extern_methods!(
        #[cfg(feature = "objc2-sprite-kit")]
        #[cfg(target_os = "macos")]
        /// Creates a component that encapsulate the given SpriteKit node. When the component is
        /// added to an entity, the SKNode's entity property will be set.
        ///
        ///
        /// Parameter `node`: Node to associate with the component.
        ///
        /// See: SKNode.entity
        #[unsafe(method(componentWithNode:))]
        #[unsafe(method_family = none)]
        pub unsafe fn componentWithNode(node: &SKNode) -> Retained<Self>;

        #[cfg(feature = "objc2-sprite-kit")]
        #[cfg(target_os = "macos")]
        /// Initializes component to encapsulate the given SpriteKit node. When the component is
        /// added to an entity, the SKNode's entity property will be set.
        ///
        ///
        /// Parameter `node`: Node to associate with the component.
        ///
        /// See: SKNode.entity
        #[unsafe(method(initWithNode:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithNode(this: Allocated<Self>, node: &SKNode) -> Retained<Self>;

        #[cfg(feature = "objc2-sprite-kit")]
        #[cfg(target_os = "macos")]
        /// The SpriteKit node this component encapsulates.
        #[unsafe(method(node))]
        #[unsafe(method_family = none)]
        pub unsafe fn node(&self, mtm: MainThreadMarker) -> Retained<SKNode>;

        #[cfg(feature = "objc2-sprite-kit")]
        #[cfg(target_os = "macos")]
        /// Setter for [`node`][Self::node].
        #[unsafe(method(setNode:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setNode(&self, node: &SKNode);
    );
}

/// Methods declared on superclass `NSObject`.
#[cfg(feature = "GKComponent")]
impl GKSKNodeComponent {
    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>;
    );
}