From 1d43d0a7364d6f761bed0bea0207f5b8f48700ef Mon Sep 17 00:00:00 2001 From: Greg Wilson Date: Mon, 27 Jun 2016 02:12:26 -0400 Subject: [PATCH] Update README.md created partial code example for usage --- README.md | 30 +++++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 3763aff..0ff0e3e 100644 --- a/README.md +++ b/README.md @@ -13,6 +13,34 @@ A React Native bridge module for interacting with [Apple HealthKit] data. 5. Click `RCTAppleHealthKit.xcodeproj` in the project navigator and go the `Build Settings` tab. Make sure 'All' is toggled on (instead of 'Basic'). In the `Search Paths` section, look for `Header Search Paths` and make sure it contains both `$(SRCROOT)/../../react-native/React` and `$(SRCROOT)/../../../React` - mark both as `recursive`. 5. Compile and have fun +### Usage +Just `require` the `react-native-apple-healthkit` module and you're ready to go! +```javascript +var AppleHealthKit = require('react-native-apple-healthkit'); -[Apple HealthKit]: https://developer.apple.com/healthkit/ \ No newline at end of file +... + +let healthKitOptions = { + permissions: { + read: ["Height", "Weight", "Steps", "DateOfBirth", "BodyMassIndex"], + write: ["Weight", "Steps"] + } +}; + +AppleHealthKit.initHealthKit(healthKitOptions, (err, res) => { + if(err) { + console.log("error initializing healthkit: ", err); + return; + } + console.log("HEALTHKIT INITIALIZED!"); + // ... +}); + +... + +``` + + + +[Apple HealthKit]: https://developer.apple.com/healthkit/ -- 2.26.2