objc2-screen-time 0.3.2

Bindings to the ScreenTime framework
Documentation
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use core::ffi::*;
use core::ptr::NonNull;
#[cfg(feature = "dispatch2")]
use dispatch2::*;
use objc2::__framework_prelude::*;

use crate::*;

extern_class!(
    /// The configuration for this device.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/screentime/stscreentimeconfiguration?language=objc)
    #[unsafe(super(NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    pub struct STScreenTimeConfiguration;
);

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

impl STScreenTimeConfiguration {
    extern_methods!(
        /// A Boolean that indicates whether the device is currently enforcing child
        /// restrictions.
        #[unsafe(method(enforcesChildRestrictions))]
        #[unsafe(method_family = none)]
        pub unsafe fn enforcesChildRestrictions(&self) -> bool;

        #[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>;
    );
}

extern_class!(
    /// The object you use to observe changes to the current configuration.
    ///
    /// Use this class to start and stop observing the current configuration. For
    /// example, you can opt to disable private browsing in your web browser’s view
    /// controller when ``STScreenTimeConfiguration/enforcesChildRestrictions`` is
    /// `true`.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/screentime/stscreentimeconfigurationobserver?language=objc)
    #[unsafe(super(NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    pub struct STScreenTimeConfigurationObserver;
);

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

impl STScreenTimeConfigurationObserver {
    extern_methods!(
        #[cfg(feature = "dispatch2")]
        /// Creates a configuration observer that reports updates on the queue you
        /// specify.
        ///
        /// - Parameters:
        /// - updateQueue: The queue on which to report updates.
        ///
        /// # Safety
        ///
        /// `update_queue` possibly has additional threading requirements.
        #[unsafe(method(initWithUpdateQueue:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithUpdateQueue(
            this: Allocated<Self>,
            update_queue: &DispatchQueue,
        ) -> Retained<Self>;

        /// Starts observing changes to the current configuration.
        #[unsafe(method(startObserving))]
        #[unsafe(method_family = none)]
        pub unsafe fn startObserving(&self);

        /// Stops observing changes to the current configuration.
        #[unsafe(method(stopObserving))]
        #[unsafe(method_family = none)]
        pub unsafe fn stopObserving(&self);

        /// The configuration being observed.
        #[unsafe(method(configuration))]
        #[unsafe(method_family = none)]
        pub unsafe fn configuration(&self) -> Option<Retained<STScreenTimeConfiguration>>;

        #[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>;
    );
}