objc2-health-kit 0.3.2

Bindings to the HealthKit 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!(
    /// An HKLiveWorkoutDataSource is to be used with an HKWorkoutBuilder to automatically collect samples
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/healthkit/hkliveworkoutdatasource?language=objc)
    #[unsafe(super(NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    pub struct HKLiveWorkoutDataSource;
);

unsafe impl Send for HKLiveWorkoutDataSource {}

unsafe impl Sync for HKLiveWorkoutDataSource {}

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

impl HKLiveWorkoutDataSource {
    extern_methods!(
        #[unsafe(method(init))]
        #[unsafe(method_family = init)]
        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;

        #[cfg(feature = "HKObjectType")]
        /// The quantity types the receiver is collecting.
        #[unsafe(method(typesToCollect))]
        #[unsafe(method_family = none)]
        pub unsafe fn typesToCollect(&self) -> Retained<NSSet<HKQuantityType>>;

        #[cfg(all(feature = "HKHealthStore", feature = "HKWorkoutConfiguration"))]
        /// The designated initializer of HKLiveWorkoutDataSource.
        ///
        ///
        /// Parameter `healthStore`: The HKHealthStore. This should match the one used to create the corresponding
        /// HKWorkoutBuilder.
        ///
        /// Parameter `configuration`: An optional workout configuration. typesToCollect will be populated with default
        /// types for the workout configuration
        #[unsafe(method(initWithHealthStore:workoutConfiguration:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithHealthStore_workoutConfiguration(
            this: Allocated<Self>,
            health_store: &HKHealthStore,
            configuration: Option<&HKWorkoutConfiguration>,
        ) -> Retained<Self>;

        #[cfg(feature = "HKObjectType")]
        /// Adds a new type of quantity sample to collect.
        ///
        /// Calling this method for a type that is already being collected will override the predicate for that type.
        ///
        ///
        /// Parameter `quantityType`: The type of sample to collect.
        ///
        /// Parameter `predicate`: If non-nil, collected samples must match this predicate.
        #[unsafe(method(enableCollectionForType:predicate:))]
        #[unsafe(method_family = none)]
        pub unsafe fn enableCollectionForType_predicate(
            &self,
            quantity_type: &HKQuantityType,
            predicate: Option<&NSPredicate>,
        );

        #[cfg(feature = "HKObjectType")]
        /// Removes the specified quantity type from the types to collect.
        ///
        ///
        /// Parameter `quantityType`: The type of sample to no longer collect.
        #[unsafe(method(disableCollectionForType:))]
        #[unsafe(method_family = none)]
        pub unsafe fn disableCollectionForType(&self, quantity_type: &HKQuantityType);
    );
}

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