objc2_health_kit/generated/
HKWorkout.rs

1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use core::ptr::NonNull;
4use objc2::__framework_prelude::*;
5use objc2_foundation::*;
6
7use crate::*;
8
9/// Represents a particular type of workout or exercise
10///
11/// See also [Apple's documentation](https://developer.apple.com/documentation/healthkit/hkworkoutactivitytype?language=objc)
12// NS_ENUM
13#[repr(transparent)]
14#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
15pub struct HKWorkoutActivityType(pub NSUInteger);
16impl HKWorkoutActivityType {
17    #[doc(alias = "HKWorkoutActivityTypeAmericanFootball")]
18    pub const AmericanFootball: Self = Self(1);
19    #[doc(alias = "HKWorkoutActivityTypeArchery")]
20    pub const Archery: Self = Self(2);
21    #[doc(alias = "HKWorkoutActivityTypeAustralianFootball")]
22    pub const AustralianFootball: Self = Self(3);
23    #[doc(alias = "HKWorkoutActivityTypeBadminton")]
24    pub const Badminton: Self = Self(4);
25    #[doc(alias = "HKWorkoutActivityTypeBaseball")]
26    pub const Baseball: Self = Self(5);
27    #[doc(alias = "HKWorkoutActivityTypeBasketball")]
28    pub const Basketball: Self = Self(6);
29    #[doc(alias = "HKWorkoutActivityTypeBowling")]
30    pub const Bowling: Self = Self(7);
31    #[doc(alias = "HKWorkoutActivityTypeBoxing")]
32    pub const Boxing: Self = Self(8);
33    #[doc(alias = "HKWorkoutActivityTypeClimbing")]
34    pub const Climbing: Self = Self(9);
35    #[doc(alias = "HKWorkoutActivityTypeCricket")]
36    pub const Cricket: Self = Self(10);
37    #[doc(alias = "HKWorkoutActivityTypeCrossTraining")]
38    pub const CrossTraining: Self = Self(11);
39    #[doc(alias = "HKWorkoutActivityTypeCurling")]
40    pub const Curling: Self = Self(12);
41    #[doc(alias = "HKWorkoutActivityTypeCycling")]
42    pub const Cycling: Self = Self(13);
43    #[doc(alias = "HKWorkoutActivityTypeDance")]
44    #[deprecated = "Use HKWorkoutActivityTypeSocialDance or HKWorkoutActivityTypeCardioDance"]
45    pub const Dance: Self = Self(14);
46    #[doc(alias = "HKWorkoutActivityTypeDanceInspiredTraining")]
47    #[deprecated = "Use HKWorkoutActivityTypeSocialDance, HKWorkoutActivityTypeCardioDance, HKWorkoutActivityTypeBarre or HKWorkoutActivityTypePilates"]
48    pub const DanceInspiredTraining: Self = Self(15);
49    #[doc(alias = "HKWorkoutActivityTypeElliptical")]
50    pub const Elliptical: Self = Self(16);
51    #[doc(alias = "HKWorkoutActivityTypeEquestrianSports")]
52    pub const EquestrianSports: Self = Self(17);
53    #[doc(alias = "HKWorkoutActivityTypeFencing")]
54    pub const Fencing: Self = Self(18);
55    #[doc(alias = "HKWorkoutActivityTypeFishing")]
56    pub const Fishing: Self = Self(19);
57    #[doc(alias = "HKWorkoutActivityTypeFunctionalStrengthTraining")]
58    pub const FunctionalStrengthTraining: Self = Self(20);
59    #[doc(alias = "HKWorkoutActivityTypeGolf")]
60    pub const Golf: Self = Self(21);
61    #[doc(alias = "HKWorkoutActivityTypeGymnastics")]
62    pub const Gymnastics: Self = Self(22);
63    #[doc(alias = "HKWorkoutActivityTypeHandball")]
64    pub const Handball: Self = Self(23);
65    #[doc(alias = "HKWorkoutActivityTypeHiking")]
66    pub const Hiking: Self = Self(24);
67    #[doc(alias = "HKWorkoutActivityTypeHockey")]
68    pub const Hockey: Self = Self(25);
69    #[doc(alias = "HKWorkoutActivityTypeHunting")]
70    pub const Hunting: Self = Self(26);
71    #[doc(alias = "HKWorkoutActivityTypeLacrosse")]
72    pub const Lacrosse: Self = Self(27);
73    #[doc(alias = "HKWorkoutActivityTypeMartialArts")]
74    pub const MartialArts: Self = Self(28);
75    #[doc(alias = "HKWorkoutActivityTypeMindAndBody")]
76    pub const MindAndBody: Self = Self(29);
77    #[doc(alias = "HKWorkoutActivityTypeMixedMetabolicCardioTraining")]
78    #[deprecated = "Use HKWorkoutActivityTypeMixedCardio or HKWorkoutActivityTypeHighIntensityIntervalTraining"]
79    pub const MixedMetabolicCardioTraining: Self = Self(30);
80    #[doc(alias = "HKWorkoutActivityTypePaddleSports")]
81    pub const PaddleSports: Self = Self(31);
82    #[doc(alias = "HKWorkoutActivityTypePlay")]
83    pub const Play: Self = Self(32);
84    #[doc(alias = "HKWorkoutActivityTypePreparationAndRecovery")]
85    pub const PreparationAndRecovery: Self = Self(33);
86    #[doc(alias = "HKWorkoutActivityTypeRacquetball")]
87    pub const Racquetball: Self = Self(34);
88    #[doc(alias = "HKWorkoutActivityTypeRowing")]
89    pub const Rowing: Self = Self(35);
90    #[doc(alias = "HKWorkoutActivityTypeRugby")]
91    pub const Rugby: Self = Self(36);
92    #[doc(alias = "HKWorkoutActivityTypeRunning")]
93    pub const Running: Self = Self(37);
94    #[doc(alias = "HKWorkoutActivityTypeSailing")]
95    pub const Sailing: Self = Self(38);
96    #[doc(alias = "HKWorkoutActivityTypeSkatingSports")]
97    pub const SkatingSports: Self = Self(39);
98    #[doc(alias = "HKWorkoutActivityTypeSnowSports")]
99    pub const SnowSports: Self = Self(40);
100    #[doc(alias = "HKWorkoutActivityTypeSoccer")]
101    pub const Soccer: Self = Self(41);
102    #[doc(alias = "HKWorkoutActivityTypeSoftball")]
103    pub const Softball: Self = Self(42);
104    #[doc(alias = "HKWorkoutActivityTypeSquash")]
105    pub const Squash: Self = Self(43);
106    #[doc(alias = "HKWorkoutActivityTypeStairClimbing")]
107    pub const StairClimbing: Self = Self(44);
108    #[doc(alias = "HKWorkoutActivityTypeSurfingSports")]
109    pub const SurfingSports: Self = Self(45);
110    #[doc(alias = "HKWorkoutActivityTypeSwimming")]
111    pub const Swimming: Self = Self(46);
112    #[doc(alias = "HKWorkoutActivityTypeTableTennis")]
113    pub const TableTennis: Self = Self(47);
114    #[doc(alias = "HKWorkoutActivityTypeTennis")]
115    pub const Tennis: Self = Self(48);
116    #[doc(alias = "HKWorkoutActivityTypeTrackAndField")]
117    pub const TrackAndField: Self = Self(49);
118    #[doc(alias = "HKWorkoutActivityTypeTraditionalStrengthTraining")]
119    pub const TraditionalStrengthTraining: Self = Self(50);
120    #[doc(alias = "HKWorkoutActivityTypeVolleyball")]
121    pub const Volleyball: Self = Self(51);
122    #[doc(alias = "HKWorkoutActivityTypeWalking")]
123    pub const Walking: Self = Self(52);
124    #[doc(alias = "HKWorkoutActivityTypeWaterFitness")]
125    pub const WaterFitness: Self = Self(53);
126    #[doc(alias = "HKWorkoutActivityTypeWaterPolo")]
127    pub const WaterPolo: Self = Self(54);
128    #[doc(alias = "HKWorkoutActivityTypeWaterSports")]
129    pub const WaterSports: Self = Self(55);
130    #[doc(alias = "HKWorkoutActivityTypeWrestling")]
131    pub const Wrestling: Self = Self(56);
132    #[doc(alias = "HKWorkoutActivityTypeYoga")]
133    pub const Yoga: Self = Self(57);
134    #[doc(alias = "HKWorkoutActivityTypeBarre")]
135    pub const Barre: Self = Self(58);
136    #[doc(alias = "HKWorkoutActivityTypeCoreTraining")]
137    pub const CoreTraining: Self = Self(59);
138    #[doc(alias = "HKWorkoutActivityTypeCrossCountrySkiing")]
139    pub const CrossCountrySkiing: Self = Self(60);
140    #[doc(alias = "HKWorkoutActivityTypeDownhillSkiing")]
141    pub const DownhillSkiing: Self = Self(61);
142    #[doc(alias = "HKWorkoutActivityTypeFlexibility")]
143    pub const Flexibility: Self = Self(62);
144    #[doc(alias = "HKWorkoutActivityTypeHighIntensityIntervalTraining")]
145    pub const HighIntensityIntervalTraining: Self = Self(63);
146    #[doc(alias = "HKWorkoutActivityTypeJumpRope")]
147    pub const JumpRope: Self = Self(64);
148    #[doc(alias = "HKWorkoutActivityTypeKickboxing")]
149    pub const Kickboxing: Self = Self(65);
150    #[doc(alias = "HKWorkoutActivityTypePilates")]
151    pub const Pilates: Self = Self(66);
152    #[doc(alias = "HKWorkoutActivityTypeSnowboarding")]
153    pub const Snowboarding: Self = Self(67);
154    #[doc(alias = "HKWorkoutActivityTypeStairs")]
155    pub const Stairs: Self = Self(68);
156    #[doc(alias = "HKWorkoutActivityTypeStepTraining")]
157    pub const StepTraining: Self = Self(69);
158    #[doc(alias = "HKWorkoutActivityTypeWheelchairWalkPace")]
159    pub const WheelchairWalkPace: Self = Self(70);
160    #[doc(alias = "HKWorkoutActivityTypeWheelchairRunPace")]
161    pub const WheelchairRunPace: Self = Self(71);
162    #[doc(alias = "HKWorkoutActivityTypeTaiChi")]
163    pub const TaiChi: Self = Self(72);
164    #[doc(alias = "HKWorkoutActivityTypeMixedCardio")]
165    pub const MixedCardio: Self = Self(73);
166    #[doc(alias = "HKWorkoutActivityTypeHandCycling")]
167    pub const HandCycling: Self = Self(74);
168    #[doc(alias = "HKWorkoutActivityTypeDiscSports")]
169    pub const DiscSports: Self = Self(75);
170    #[doc(alias = "HKWorkoutActivityTypeFitnessGaming")]
171    pub const FitnessGaming: Self = Self(76);
172    #[doc(alias = "HKWorkoutActivityTypeCardioDance")]
173    pub const CardioDance: Self = Self(77);
174    #[doc(alias = "HKWorkoutActivityTypeSocialDance")]
175    pub const SocialDance: Self = Self(78);
176    #[doc(alias = "HKWorkoutActivityTypePickleball")]
177    pub const Pickleball: Self = Self(79);
178    #[doc(alias = "HKWorkoutActivityTypeCooldown")]
179    pub const Cooldown: Self = Self(80);
180    #[doc(alias = "HKWorkoutActivityTypeSwimBikeRun")]
181    pub const SwimBikeRun: Self = Self(82);
182    #[doc(alias = "HKWorkoutActivityTypeTransition")]
183    pub const Transition: Self = Self(83);
184    #[doc(alias = "HKWorkoutActivityTypeUnderwaterDiving")]
185    pub const UnderwaterDiving: Self = Self(84);
186    #[doc(alias = "HKWorkoutActivityTypeOther")]
187    pub const Other: Self = Self(3000);
188}
189
190unsafe impl Encode for HKWorkoutActivityType {
191    const ENCODING: Encoding = NSUInteger::ENCODING;
192}
193
194unsafe impl RefEncode for HKWorkoutActivityType {
195    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
196}
197
198/// [Apple's documentation](https://developer.apple.com/documentation/healthkit/hkworkouteventtype?language=objc)
199// NS_ENUM
200#[repr(transparent)]
201#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
202pub struct HKWorkoutEventType(pub NSInteger);
203impl HKWorkoutEventType {
204    #[doc(alias = "HKWorkoutEventTypePause")]
205    pub const Pause: Self = Self(1);
206    #[doc(alias = "HKWorkoutEventTypeResume")]
207    pub const Resume: Self = Self(2);
208    #[doc(alias = "HKWorkoutEventTypeLap")]
209    pub const Lap: Self = Self(3);
210    #[doc(alias = "HKWorkoutEventTypeMarker")]
211    pub const Marker: Self = Self(4);
212    #[doc(alias = "HKWorkoutEventTypeMotionPaused")]
213    pub const MotionPaused: Self = Self(5);
214    #[doc(alias = "HKWorkoutEventTypeMotionResumed")]
215    pub const MotionResumed: Self = Self(6);
216    #[doc(alias = "HKWorkoutEventTypeSegment")]
217    pub const Segment: Self = Self(7);
218    #[doc(alias = "HKWorkoutEventTypePauseOrResumeRequest")]
219    pub const PauseOrResumeRequest: Self = Self(8);
220}
221
222unsafe impl Encode for HKWorkoutEventType {
223    const ENCODING: Encoding = NSInteger::ENCODING;
224}
225
226unsafe impl RefEncode for HKWorkoutEventType {
227    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
228}
229
230extern_class!(
231    /// Represents a particular event that occurred during a workout.
232    ///
233    /// See also [Apple's documentation](https://developer.apple.com/documentation/healthkit/hkworkoutevent?language=objc)
234    #[unsafe(super(NSObject))]
235    #[derive(Debug, PartialEq, Eq, Hash)]
236    pub struct HKWorkoutEvent;
237);
238
239unsafe impl Send for HKWorkoutEvent {}
240
241unsafe impl Sync for HKWorkoutEvent {}
242
243extern_conformance!(
244    unsafe impl NSCoding for HKWorkoutEvent {}
245);
246
247extern_conformance!(
248    unsafe impl NSCopying for HKWorkoutEvent {}
249);
250
251unsafe impl CopyingHelper for HKWorkoutEvent {
252    type Result = Self;
253}
254
255extern_conformance!(
256    unsafe impl NSObjectProtocol for HKWorkoutEvent {}
257);
258
259extern_conformance!(
260    unsafe impl NSSecureCoding for HKWorkoutEvent {}
261);
262
263impl HKWorkoutEvent {
264    extern_methods!(
265        /// Represents the type of event that occurred during a workout.
266        #[unsafe(method(type))]
267        #[unsafe(method_family = none)]
268        pub unsafe fn r#type(&self) -> HKWorkoutEventType;
269
270        #[deprecated]
271        #[unsafe(method(date))]
272        #[unsafe(method_family = none)]
273        pub unsafe fn date(&self) -> Retained<NSDate>;
274
275        /// Date interval representing the time period for which the event is valid.
276        ///
277        /// Most event types only support date intervals with zero duration. Events of type HKWorkoutEventTypeLap
278        /// and HKWorkoutEventTypeSegment are currently the only events that support a nonzero duration.
279        #[unsafe(method(dateInterval))]
280        #[unsafe(method_family = none)]
281        pub unsafe fn dateInterval(&self) -> Retained<NSDateInterval>;
282
283        /// Extra information describing properties of the receiver.
284        ///
285        /// Keys must be NSString and values must be either NSString, NSNumber, NSDate, or
286        /// HKQuantity. See HKMetadata.h for potential metadata keys and values.
287        #[unsafe(method(metadata))]
288        #[unsafe(method_family = none)]
289        pub unsafe fn metadata(&self) -> Option<Retained<NSDictionary<NSString, AnyObject>>>;
290
291        #[deprecated]
292        #[unsafe(method(workoutEventWithType:date:))]
293        #[unsafe(method_family = none)]
294        pub unsafe fn workoutEventWithType_date(
295            r#type: HKWorkoutEventType,
296            date: &NSDate,
297        ) -> Retained<Self>;
298
299        /// # Safety
300        ///
301        /// `metadata` generic should be of the correct type.
302        #[deprecated]
303        #[unsafe(method(workoutEventWithType:date:metadata:))]
304        #[unsafe(method_family = none)]
305        pub unsafe fn workoutEventWithType_date_metadata(
306            r#type: HKWorkoutEventType,
307            date: &NSDate,
308            metadata: &NSDictionary<NSString, AnyObject>,
309        ) -> Retained<Self>;
310
311        /// Creates an event with a date interval with or without a duration.
312        ///
313        /// Parameter `type`: The type of event to create
314        ///
315        /// Parameter `dateInterval`: The dateInterval over which the event occurs
316        ///
317        /// Parameter `metadata`: Dictionary of metadata associated with the event, nullable
318        ///
319        /// # Safety
320        ///
321        /// `metadata` generic should be of the correct type.
322        #[unsafe(method(workoutEventWithType:dateInterval:metadata:))]
323        #[unsafe(method_family = none)]
324        pub unsafe fn workoutEventWithType_dateInterval_metadata(
325            r#type: HKWorkoutEventType,
326            date_interval: &NSDateInterval,
327            metadata: Option<&NSDictionary<NSString, AnyObject>>,
328        ) -> Retained<Self>;
329
330        #[unsafe(method(init))]
331        #[unsafe(method_family = init)]
332        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
333    );
334}
335
336/// Methods declared on superclass `NSObject`.
337impl HKWorkoutEvent {
338    extern_methods!(
339        #[unsafe(method(new))]
340        #[unsafe(method_family = new)]
341        pub unsafe fn new() -> Retained<Self>;
342    );
343}
344
345extern_class!(
346    /// An HKObject subclass representing a workout or activity
347    ///
348    /// See also [Apple's documentation](https://developer.apple.com/documentation/healthkit/hkworkout?language=objc)
349    #[unsafe(super(HKSample, HKObject, NSObject))]
350    #[derive(Debug, PartialEq, Eq, Hash)]
351    #[cfg(all(feature = "HKObject", feature = "HKSample"))]
352    pub struct HKWorkout;
353);
354
355#[cfg(all(feature = "HKObject", feature = "HKSample"))]
356unsafe impl Send for HKWorkout {}
357
358#[cfg(all(feature = "HKObject", feature = "HKSample"))]
359unsafe impl Sync for HKWorkout {}
360
361#[cfg(all(feature = "HKObject", feature = "HKSample"))]
362extern_conformance!(
363    unsafe impl NSCoding for HKWorkout {}
364);
365
366#[cfg(all(feature = "HKObject", feature = "HKSample"))]
367extern_conformance!(
368    unsafe impl NSObjectProtocol for HKWorkout {}
369);
370
371#[cfg(all(feature = "HKObject", feature = "HKSample"))]
372extern_conformance!(
373    unsafe impl NSSecureCoding for HKWorkout {}
374);
375
376#[cfg(all(feature = "HKObject", feature = "HKSample"))]
377impl HKWorkout {
378    extern_methods!(
379        /// Represents the activity that the user was performing during a workout
380        #[unsafe(method(workoutActivityType))]
381        #[unsafe(method_family = none)]
382        pub unsafe fn workoutActivityType(&self) -> HKWorkoutActivityType;
383
384        /// An array of HKWorkoutEvents that occurred during a workout.
385        ///
386        /// These events will be ordered by date in ascending order. All events must take place
387        /// between the start date and end date of the workout. The first workout event should never be a resume event
388        /// because it is assumed that the workout begins in a running state.
389        #[unsafe(method(workoutEvents))]
390        #[unsafe(method_family = none)]
391        pub unsafe fn workoutEvents(&self) -> Option<Retained<NSArray<HKWorkoutEvent>>>;
392
393        #[cfg(feature = "HKWorkoutActivity")]
394        /// An array of HKWorkoutActivities that were performed during a workout.
395        ///
396        /// These activities will be ordered by date in ascending order. All activities must take place
397        /// between the start date and end date of the workout.
398        #[unsafe(method(workoutActivities))]
399        #[unsafe(method_family = none)]
400        pub unsafe fn workoutActivities(&self) -> Retained<NSArray<HKWorkoutActivity>>;
401
402        /// The length of time that a workout was recording
403        ///
404        /// The duration is derived from the start and end dates of the workout and takes into account periods that the
405        /// workout was paused. Periods that the workout was paused are based off of the workoutEvents property.
406        #[unsafe(method(duration))]
407        #[unsafe(method_family = none)]
408        pub unsafe fn duration(&self) -> NSTimeInterval;
409
410        #[cfg(feature = "HKQuantity")]
411        /// The amount of energy that was burned during a workout
412        ///
413        /// This metric should represent the total active energy burned during the course of the workout. It should be a
414        /// quantity with a unit representing energy.
415        #[deprecated = "Use statisticsForType: passing the HKQuantityType for HKQuantityTypeIdentifierActiveEnergyBurned"]
416        #[unsafe(method(totalEnergyBurned))]
417        #[unsafe(method_family = none)]
418        pub unsafe fn totalEnergyBurned(&self) -> Option<Retained<HKQuantity>>;
419
420        #[cfg(feature = "HKQuantity")]
421        /// The total distance that was traveled during a workout
422        ///
423        /// This metric should represent the total distance traveled during the course of the workout. It should be a
424        /// quantity with a unit representing length.
425        #[deprecated = "Use statisticsForType: passing the HKQuantityType for the desired distance type"]
426        #[unsafe(method(totalDistance))]
427        #[unsafe(method_family = none)]
428        pub unsafe fn totalDistance(&self) -> Option<Retained<HKQuantity>>;
429
430        #[cfg(feature = "HKQuantity")]
431        /// The total count of swimming strokes that was accumulated during a workout
432        ///
433        /// This metric should represent the total count of swimming strokes accumulated during the course of the
434        /// workout. It should be a quantity with a unit representing count.
435        #[deprecated = "Use statisticsForType: passing the HKQuantityType for HKQuantityTypeIdentifierSwimmingStrokeCount"]
436        #[unsafe(method(totalSwimmingStrokeCount))]
437        #[unsafe(method_family = none)]
438        pub unsafe fn totalSwimmingStrokeCount(&self) -> Option<Retained<HKQuantity>>;
439
440        #[cfg(feature = "HKQuantity")]
441        /// The total count of flights climbed during a workout
442        ///
443        /// This metric should represent the total count of flights accumulated during the course of the
444        /// workout. It should be a quantity with a unit representing count.
445        #[deprecated = "Use statisticsForType: passing the HKQuantityType for HKQuantityTypeIdentifierFlightClimbed"]
446        #[unsafe(method(totalFlightsClimbed))]
447        #[unsafe(method_family = none)]
448        pub unsafe fn totalFlightsClimbed(&self) -> Option<Retained<HKQuantity>>;
449
450        #[cfg(all(feature = "HKObjectType", feature = "HKStatistics"))]
451        /// A dictionary of statistics per quantity type during the workout
452        ///
453        /// This dictionary will contain HKStatistics objects containing the statistics by quantity
454        /// sample type for all of the samples that have been added to the workout.
455        #[unsafe(method(allStatistics))]
456        #[unsafe(method_family = none)]
457        pub unsafe fn allStatistics(&self) -> Retained<NSDictionary<HKQuantityType, HKStatistics>>;
458
459        #[cfg(all(feature = "HKObjectType", feature = "HKStatistics"))]
460        /// Returns an HKStatistics object containing the statistics for all the samples of the given type that
461        /// have been added to the workout. If there are no samples of the given type then nil is returned.
462        ///
463        ///
464        /// Parameter `quantityType`: The quantity type to gather statistics about.
465        #[unsafe(method(statisticsForType:))]
466        #[unsafe(method_family = none)]
467        pub unsafe fn statisticsForType(
468            &self,
469            quantity_type: &HKQuantityType,
470        ) -> Option<Retained<HKStatistics>>;
471
472        /// Parameter `workoutActivityType`: The activity type of the workout
473        ///
474        /// Parameter `startDate`: The point in time that the workout was started
475        ///
476        /// Parameter `endDate`: The point in time that the workout was ended
477        #[deprecated = "Use HKWorkoutBuilder"]
478        #[unsafe(method(workoutWithActivityType:startDate:endDate:))]
479        #[unsafe(method_family = none)]
480        pub unsafe fn workoutWithActivityType_startDate_endDate(
481            workout_activity_type: HKWorkoutActivityType,
482            start_date: &NSDate,
483            end_date: &NSDate,
484        ) -> Retained<Self>;
485
486        #[cfg(feature = "HKQuantity")]
487        /// If the optional total parameters are specified, matching samples that add up to the calculated total quantities
488        /// should be associated with this workout using addSamples:toWorkout:completion: in HKHealthStore.
489        ///
490        ///
491        /// Parameter `workoutActivityType`: The activity type of the workout
492        ///
493        /// Parameter `startDate`: The point in time that the workout was started
494        ///
495        /// Parameter `endDate`: The point in time that the workout was ended
496        ///
497        /// Parameter `workoutEvents`: An array of HKWorkoutEvents. The workout's duration is derived from these events. (Optional)
498        ///
499        /// Parameter `totalEnergyBurned`: The amount of energy that was burned during the workout. (Optional)
500        ///
501        /// Parameter `totalDistance`: The total distance that was traveled during the workout. (Optional)
502        ///
503        /// Parameter `metadata`: Metadata for the workout. (Optional)
504        ///
505        /// # Safety
506        ///
507        /// `metadata` generic should be of the correct type.
508        #[deprecated = "Use HKWorkoutBuilder"]
509        #[unsafe(method(workoutWithActivityType:startDate:endDate:workoutEvents:totalEnergyBurned:totalDistance:metadata:))]
510        #[unsafe(method_family = none)]
511        pub unsafe fn workoutWithActivityType_startDate_endDate_workoutEvents_totalEnergyBurned_totalDistance_metadata(
512            workout_activity_type: HKWorkoutActivityType,
513            start_date: &NSDate,
514            end_date: &NSDate,
515            workout_events: Option<&NSArray<HKWorkoutEvent>>,
516            total_energy_burned: Option<&HKQuantity>,
517            total_distance: Option<&HKQuantity>,
518            metadata: Option<&NSDictionary<NSString, AnyObject>>,
519        ) -> Retained<Self>;
520
521        #[cfg(all(feature = "HKDevice", feature = "HKQuantity"))]
522        /// If the optional total parameters are specified, matching samples that add up to the calculated total quantities
523        /// should be associated with this workout using addSamples:toWorkout:completion: in HKHealthStore.
524        ///
525        ///
526        /// Parameter `workoutActivityType`: The activity type of the workout
527        ///
528        /// Parameter `startDate`: The point in time that the workout was started
529        ///
530        /// Parameter `endDate`: The point in time that the workout was ended
531        ///
532        /// Parameter `workoutEvents`: An array of HKWorkoutEvents. The workout's duration is derived from these events. (Optional)
533        ///
534        /// Parameter `totalEnergyBurned`: The amount of energy that was burned during the workout. (Optional)
535        ///
536        /// Parameter `totalDistance`: The total distance that was traveled during the workout. (Optional)
537        ///
538        /// Parameter `device`: The HKDevice associated with the workout. (Optional)
539        ///
540        /// Parameter `metadata`: Metadata for the workout. (Optional)
541        ///
542        /// # Safety
543        ///
544        /// `metadata` generic should be of the correct type.
545        #[deprecated = "Use HKWorkoutBuilder"]
546        #[unsafe(method(workoutWithActivityType:startDate:endDate:workoutEvents:totalEnergyBurned:totalDistance:device:metadata:))]
547        #[unsafe(method_family = none)]
548        pub unsafe fn workoutWithActivityType_startDate_endDate_workoutEvents_totalEnergyBurned_totalDistance_device_metadata(
549            workout_activity_type: HKWorkoutActivityType,
550            start_date: &NSDate,
551            end_date: &NSDate,
552            workout_events: Option<&NSArray<HKWorkoutEvent>>,
553            total_energy_burned: Option<&HKQuantity>,
554            total_distance: Option<&HKQuantity>,
555            device: Option<&HKDevice>,
556            metadata: Option<&NSDictionary<NSString, AnyObject>>,
557        ) -> Retained<Self>;
558
559        #[cfg(feature = "HKQuantity")]
560        /// If the optional total parameters are specified, matching samples that add up to the calculated total quantities
561        /// should be associated with this workout using addSamples:toWorkout:completion: in HKHealthStore.
562        ///
563        ///
564        /// Parameter `workoutActivityType`: The activity type of the workout
565        ///
566        /// Parameter `startDate`: The point in time that the workout was started
567        ///
568        /// Parameter `endDate`: The point in time that the workout was ended
569        ///
570        /// Parameter `duration`: The duration of the workout. If 0, the difference between startDate and endDate is used.
571        ///
572        /// Parameter `totalEnergyBurned`: The amount of energy that was burned during the workout. (Optional)
573        ///
574        /// Parameter `totalDistance`: The total distance that was traveled during the workout. (Optional)
575        ///
576        /// Parameter `metadata`: Metadata for the workout. (Optional)
577        ///
578        /// # Safety
579        ///
580        /// `metadata` generic should be of the correct type.
581        #[deprecated = "Use HKWorkoutBuilder"]
582        #[unsafe(method(workoutWithActivityType:startDate:endDate:duration:totalEnergyBurned:totalDistance:metadata:))]
583        #[unsafe(method_family = none)]
584        pub unsafe fn workoutWithActivityType_startDate_endDate_duration_totalEnergyBurned_totalDistance_metadata(
585            workout_activity_type: HKWorkoutActivityType,
586            start_date: &NSDate,
587            end_date: &NSDate,
588            duration: NSTimeInterval,
589            total_energy_burned: Option<&HKQuantity>,
590            total_distance: Option<&HKQuantity>,
591            metadata: Option<&NSDictionary<NSString, AnyObject>>,
592        ) -> Retained<Self>;
593
594        #[cfg(all(feature = "HKDevice", feature = "HKQuantity"))]
595        /// If the optional total parameters are specified, matching samples that add up to the calculated total quantities
596        /// should be associated with this workout using addSamples:toWorkout:completion: in HKHealthStore.
597        ///
598        ///
599        /// Parameter `workoutActivityType`: The activity type of the workout
600        ///
601        /// Parameter `startDate`: The point in time that the workout was started
602        ///
603        /// Parameter `endDate`: The point in time that the workout was ended
604        ///
605        /// Parameter `duration`: The duration of the workout. If 0, the difference between startDate and endDate is used.
606        ///
607        /// Parameter `totalEnergyBurned`: The amount of energy that was burned during the workout. (Optional)
608        ///
609        /// Parameter `totalDistance`: The total distance that was traveled during the workout. (Optional)
610        ///
611        /// Parameter `device`: The HKDevice associated with the workout. (Optional)
612        ///
613        /// Parameter `metadata`: Metadata for the workout. (Optional)
614        ///
615        /// # Safety
616        ///
617        /// `metadata` generic should be of the correct type.
618        #[deprecated = "Use HKWorkoutBuilder"]
619        #[unsafe(method(workoutWithActivityType:startDate:endDate:duration:totalEnergyBurned:totalDistance:device:metadata:))]
620        #[unsafe(method_family = none)]
621        pub unsafe fn workoutWithActivityType_startDate_endDate_duration_totalEnergyBurned_totalDistance_device_metadata(
622            workout_activity_type: HKWorkoutActivityType,
623            start_date: &NSDate,
624            end_date: &NSDate,
625            duration: NSTimeInterval,
626            total_energy_burned: Option<&HKQuantity>,
627            total_distance: Option<&HKQuantity>,
628            device: Option<&HKDevice>,
629            metadata: Option<&NSDictionary<NSString, AnyObject>>,
630        ) -> Retained<Self>;
631
632        #[cfg(all(feature = "HKDevice", feature = "HKQuantity"))]
633        /// If the optional total parameters are specified, matching samples that add up to the calculated total quantities
634        /// should be associated with this workout using addSamples:toWorkout:completion: in HKHealthStore.
635        ///
636        ///
637        /// Parameter `workoutActivityType`: The activity type of the workout
638        ///
639        /// Parameter `startDate`: The point in time that the workout was started
640        ///
641        /// Parameter `endDate`: The point in time that the workout was ended
642        ///
643        /// Parameter `workoutEvents`: An array of HKWorkoutEvents. The workout's duration is derived from these events. (Optional)
644        ///
645        /// Parameter `totalEnergyBurned`: The amount of energy that was burned during the workout. (Optional)
646        ///
647        /// Parameter `totalDistance`: The total distance that was traveled during the workout. (Optional)
648        ///
649        /// Parameter `totalSwimmingStrokeCount`: The total count of swimming strokes that was accumulated during the workout. (Optional)
650        ///
651        /// Parameter `device`: The HKDevice associated with the workout. (Optional)
652        ///
653        /// Parameter `metadata`: Metadata for the workout. (Optional)
654        ///
655        /// # Safety
656        ///
657        /// `metadata` generic should be of the correct type.
658        #[deprecated = "Use HKWorkoutBuilder"]
659        #[unsafe(method(workoutWithActivityType:startDate:endDate:workoutEvents:totalEnergyBurned:totalDistance:totalSwimmingStrokeCount:device:metadata:))]
660        #[unsafe(method_family = none)]
661        pub unsafe fn workoutWithActivityType_startDate_endDate_workoutEvents_totalEnergyBurned_totalDistance_totalSwimmingStrokeCount_device_metadata(
662            workout_activity_type: HKWorkoutActivityType,
663            start_date: &NSDate,
664            end_date: &NSDate,
665            workout_events: Option<&NSArray<HKWorkoutEvent>>,
666            total_energy_burned: Option<&HKQuantity>,
667            total_distance: Option<&HKQuantity>,
668            total_swimming_stroke_count: Option<&HKQuantity>,
669            device: Option<&HKDevice>,
670            metadata: Option<&NSDictionary<NSString, AnyObject>>,
671        ) -> Retained<Self>;
672
673        #[cfg(all(feature = "HKDevice", feature = "HKQuantity"))]
674        /// If the optional total parameters are specified, matching samples that add up to the calculated total
675        /// quantities should be associated with this workout using addSamples:toWorkout:completion: in
676        /// HKHealthStore.
677        ///
678        ///
679        /// Parameter `workoutActivityType`: The activity type of the workout
680        ///
681        /// Parameter `startDate`: The point in time that the workout was started
682        ///
683        /// Parameter `endDate`: The point in time that the workout was ended
684        ///
685        /// Parameter `workoutEvents`: An array of HKWorkoutEvents. The workout's duration is derived from these events. (Optional)
686        ///
687        /// Parameter `totalEnergyBurned`: The amount of energy that was burned during the workout. (Optional)
688        ///
689        /// Parameter `totalDistance`: The total distance that was traveled during the workout. (Optional)
690        ///
691        /// Parameter `totalFlightsClimbed`: The total count of flights climbed that was accumulated during the workout. (Optional)
692        ///
693        /// Parameter `device`: The HKDevice associated with the workout. (Optional)
694        ///
695        /// Parameter `metadata`: Metadata for the workout. (Optional)
696        ///
697        /// # Safety
698        ///
699        /// `metadata` generic should be of the correct type.
700        #[deprecated = "Use HKWorkoutBuilder"]
701        #[unsafe(method(workoutWithActivityType:startDate:endDate:workoutEvents:totalEnergyBurned:totalDistance:totalFlightsClimbed:device:metadata:))]
702        #[unsafe(method_family = none)]
703        pub unsafe fn workoutWithActivityType_startDate_endDate_workoutEvents_totalEnergyBurned_totalDistance_totalFlightsClimbed_device_metadata(
704            workout_activity_type: HKWorkoutActivityType,
705            start_date: &NSDate,
706            end_date: &NSDate,
707            workout_events: Option<&NSArray<HKWorkoutEvent>>,
708            total_energy_burned: Option<&HKQuantity>,
709            total_distance: Option<&HKQuantity>,
710            total_flights_climbed: Option<&HKQuantity>,
711            device: Option<&HKDevice>,
712            metadata: Option<&NSDictionary<NSString, AnyObject>>,
713        ) -> Retained<Self>;
714    );
715}
716
717/// Methods declared on superclass `HKObject`.
718#[cfg(all(feature = "HKObject", feature = "HKSample"))]
719impl HKWorkout {
720    extern_methods!(
721        #[unsafe(method(init))]
722        #[unsafe(method_family = init)]
723        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
724    );
725}
726
727/// Methods declared on superclass `NSObject`.
728#[cfg(all(feature = "HKObject", feature = "HKSample"))]
729impl HKWorkout {
730    extern_methods!(
731        #[unsafe(method(new))]
732        #[unsafe(method_family = new)]
733        pub unsafe fn new() -> Retained<Self>;
734    );
735}
736
737extern "C" {
738    /// [Apple's documentation](https://developer.apple.com/documentation/healthkit/hkpredicatekeypathworkoutduration?language=objc)
739    pub static HKPredicateKeyPathWorkoutDuration: &'static NSString;
740}
741
742extern "C" {
743    /// [Apple's documentation](https://developer.apple.com/documentation/healthkit/hkpredicatekeypathworkouttotaldistance?language=objc)
744    #[deprecated = "Use predicateForWorkoutActivitiesWithOperatorType:quantityType:sumQuantity: passing the HKQuantityType for the desired distance type"]
745    pub static HKPredicateKeyPathWorkoutTotalDistance: &'static NSString;
746}
747
748extern "C" {
749    /// [Apple's documentation](https://developer.apple.com/documentation/healthkit/hkpredicatekeypathworkouttotalenergyburned?language=objc)
750    #[deprecated = "Use predicateForWorkoutActivitiesWithOperatorType:quantityType:sumQuantity: passing the HKQuantityType for HKQuantityTypeIdentifierActiveEnergyBurned"]
751    pub static HKPredicateKeyPathWorkoutTotalEnergyBurned: &'static NSString;
752}
753
754extern "C" {
755    /// [Apple's documentation](https://developer.apple.com/documentation/healthkit/hkpredicatekeypathworkouttype?language=objc)
756    pub static HKPredicateKeyPathWorkoutType: &'static NSString;
757}
758
759extern "C" {
760    /// [Apple's documentation](https://developer.apple.com/documentation/healthkit/hkpredicatekeypathworkouttotalswimmingstrokecount?language=objc)
761    #[deprecated = "Use predicateForWorkoutActivitiesWithOperatorType:quantityType:sumQuantity: passing the HKQuantityType for HKQuantityTypeIdentifierSwimmingStrokeCount"]
762    pub static HKPredicateKeyPathWorkoutTotalSwimmingStrokeCount: &'static NSString;
763}
764
765extern "C" {
766    /// [Apple's documentation](https://developer.apple.com/documentation/healthkit/hkpredicatekeypathworkouttotalflightsclimbed?language=objc)
767    #[deprecated = "Use predicateForWorkoutActivitiesWithOperatorType:quantityType:sumQuantity: passing the HKQuantityType for HKQuantityTypeIdentifierFlightsClimbed"]
768    pub static HKPredicateKeyPathWorkoutTotalFlightsClimbed: &'static NSString;
769}
770
771extern "C" {
772    /// [Apple's documentation](https://developer.apple.com/documentation/healthkit/hkpredicatekeypathworkoutsumquantity?language=objc)
773    pub static HKPredicateKeyPathWorkoutSumQuantity: &'static NSString;
774}
775
776extern "C" {
777    /// [Apple's documentation](https://developer.apple.com/documentation/healthkit/hkpredicatekeypathworkoutminimumquantity?language=objc)
778    pub static HKPredicateKeyPathWorkoutMinimumQuantity: &'static NSString;
779}
780
781extern "C" {
782    /// [Apple's documentation](https://developer.apple.com/documentation/healthkit/hkpredicatekeypathworkoutmaximumquantity?language=objc)
783    pub static HKPredicateKeyPathWorkoutMaximumQuantity: &'static NSString;
784}
785
786extern "C" {
787    /// [Apple's documentation](https://developer.apple.com/documentation/healthkit/hkpredicatekeypathworkoutaveragequantity?language=objc)
788    pub static HKPredicateKeyPathWorkoutAverageQuantity: &'static NSString;
789}
790
791extern "C" {
792    /// [Apple's documentation](https://developer.apple.com/documentation/healthkit/hkpredicatekeypathworkoutactivity?language=objc)
793    pub static HKPredicateKeyPathWorkoutActivity: &'static NSString;
794}
795
796extern "C" {
797    /// [Apple's documentation](https://developer.apple.com/documentation/healthkit/hkworkoutsortidentifierduration?language=objc)
798    pub static HKWorkoutSortIdentifierDuration: &'static NSString;
799}
800
801extern "C" {
802    /// [Apple's documentation](https://developer.apple.com/documentation/healthkit/hkworkoutsortidentifiertotaldistance?language=objc)
803    pub static HKWorkoutSortIdentifierTotalDistance: &'static NSString;
804}
805
806extern "C" {
807    /// [Apple's documentation](https://developer.apple.com/documentation/healthkit/hkworkoutsortidentifiertotalenergyburned?language=objc)
808    pub static HKWorkoutSortIdentifierTotalEnergyBurned: &'static NSString;
809}
810
811extern "C" {
812    /// [Apple's documentation](https://developer.apple.com/documentation/healthkit/hkworkoutsortidentifiertotalswimmingstrokecount?language=objc)
813    pub static HKWorkoutSortIdentifierTotalSwimmingStrokeCount: &'static NSString;
814}
815
816extern "C" {
817    /// [Apple's documentation](https://developer.apple.com/documentation/healthkit/hkworkoutsortidentifiertotalflightsclimbed?language=objc)
818    pub static HKWorkoutSortIdentifierTotalFlightsClimbed: &'static NSString;
819}