Skip to content

Use nil for object pointers and HKSampleType for generic sample iteration#16

Merged
tetujin merged 2 commits intofeature/healthkit-added-duration-obtain-funcfrom
copilot/sub-pr-15
Feb 9, 2026
Merged

Use nil for object pointers and HKSampleType for generic sample iteration#16
tetujin merged 2 commits intofeature/healthkit-added-duration-obtain-funcfrom
copilot/sub-pr-15

Conversation

Copy link
Contributor

Copilot AI commented Feb 9, 2026

Addresses code review feedback on PR #15 regarding Objective-C pointer conventions and type safety in HealthKit data fetching.

Changes:

  • Changed fetchEndDate = NULL to fetchEndDate = nil in initialization
  • Changed loop iterator from HKQuantityType * to HKSampleType * in readDataWithDataTypes:

Rationale:

  • nil is the standard for Objective-C object pointers vs NULL for C pointers
  • HKSampleType * correctly handles all HealthKit sample types (quantity, category, correlation, workout) returned by dataTypesToRead, not just quantities
- (void) readDataWithDataTypes: (NSSet *) types {
-    for (HKQuantityType * set in types) {
+    for (HKSampleType * set in types) {
        // Process any sample type, not just quantities
    }
}

💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Co-authored-by: tetujin <1227623+tetujin@users.noreply.github.com>
Copilot AI changed the title [WIP] Address feedback on HealthKit function for obtaining data Use nil for object pointers and HKSampleType for generic sample iteration Feb 9, 2026
Copilot AI requested a review from tetujin February 9, 2026 22:32
Copy link
Owner

@tetujin tetujin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@tetujin tetujin marked this pull request as ready for review February 9, 2026 22:40
@tetujin tetujin merged commit f435a50 into feature/healthkit-added-duration-obtain-func Feb 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants