Skip to content

Latest commit

 

History

History
36 lines (28 loc) · 656 Bytes

saveWeight.md

File metadata and controls

36 lines (28 loc) · 656 Bytes

saveWeight

save a numeric weight value to Healthkit

saveWeight accepts an options object containing a numeric weight value:

Example input options:

let options = {
  value: 200,
  unit: AppleHealthKit.Constants.Units.gram,  // optional; default pounds
  startDate: new Date(2021, 0, 0).toISOString() // optional; default now
}

Call the method:

AppleHealthKit.saveWeight(
  (options: HealthInputOptions),
  (err: Object, results: number) => {
    if (err) {
      console.log('error saving weight to Healthkit: ', err)
      return
    }
    // weight successfully saved
  },
)

Example output:

200