objc2-class-kit 0.3.2

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

extern_class!(
    /// CLSScoreItem represents user generated score information.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/classkit/clsscoreitem?language=objc)
    #[unsafe(super(CLSActivityItem, CLSObject, NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    #[cfg(all(feature = "CLSActivityItem", feature = "CLSObject"))]
    pub struct CLSScoreItem;
);

#[cfg(all(feature = "CLSActivityItem", feature = "CLSObject"))]
extern_conformance!(
    unsafe impl NSCoding for CLSScoreItem {}
);

#[cfg(all(feature = "CLSActivityItem", feature = "CLSObject"))]
extern_conformance!(
    unsafe impl NSObjectProtocol for CLSScoreItem {}
);

#[cfg(all(feature = "CLSActivityItem", feature = "CLSObject"))]
extern_conformance!(
    unsafe impl NSSecureCoding for CLSScoreItem {}
);

#[cfg(all(feature = "CLSActivityItem", feature = "CLSObject"))]
impl CLSScoreItem {
    extern_methods!(
        /// Score out of
        /// `maxScore.`
        /// Should be between zero and
        /// `maxScore`[0.0,maxScore].
        #[unsafe(method(score))]
        #[unsafe(method_family = none)]
        pub unsafe fn score(&self) -> c_double;

        /// Setter for [`score`][Self::score].
        #[unsafe(method(setScore:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setScore(&self, score: c_double);

        /// Total score possible.
        ///
        /// Must be greater than zero.
        #[unsafe(method(maxScore))]
        #[unsafe(method_family = none)]
        pub unsafe fn maxScore(&self) -> c_double;

        /// Setter for [`maxScore`][Self::maxScore].
        #[unsafe(method(setMaxScore:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setMaxScore(&self, max_score: c_double);

        /// Create a score item with identifiers, title, score and maximum score.
        ///
        /// Parameter `identifier`: An identifier that is unique within activity.
        ///
        /// Parameter `title`: Title of score. Ex
        /// _Biology-_Cellular Division Quiz
        ///
        /// Parameter `score`: The score the user received.
        ///
        /// Parameter `maxScore`: The maximum score possible.
        #[unsafe(method(initWithIdentifier:title:score:maxScore:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithIdentifier_title_score_maxScore(
            this: Allocated<Self>,
            identifier: &NSString,
            title: &NSString,
            score: c_double,
            max_score: c_double,
        ) -> Retained<Self>;
    );
}

/// Methods declared on superclass `CLSActivityItem`.
#[cfg(all(feature = "CLSActivityItem", feature = "CLSObject"))]
impl CLSScoreItem {
    extern_methods!(
        #[unsafe(method(new))]
        #[unsafe(method_family = new)]
        pub unsafe fn new() -> Retained<Self>;

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