{"id":15018401,"url":"https://github.com/nativescript/sample-ios-healthkit","last_synced_at":"2025-10-19T16:30:50.965Z","repository":{"id":31658399,"uuid":"35223754","full_name":"NativeScript/sample-iOS-HealthKit","owner":"NativeScript","description":"This sample shows a simple use of the iOS HealthKit APIs.","archived":false,"fork":false,"pushed_at":"2018-02-16T08:47:34.000Z","size":3174,"stargazers_count":11,"open_issues_count":0,"forks_count":5,"subscribers_count":46,"default_branch":"master","last_synced_at":"2024-10-29T15:51:51.829Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/NativeScript.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-05-07T14:10:00.000Z","updated_at":"2022-04-13T22:37:47.000Z","dependencies_parsed_at":"2022-09-10T00:51:42.572Z","dependency_job_id":null,"html_url":"https://github.com/NativeScript/sample-iOS-HealthKit","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NativeScript%2Fsample-iOS-HealthKit","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NativeScript%2Fsample-iOS-HealthKit/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NativeScript%2Fsample-iOS-HealthKit/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NativeScript%2Fsample-iOS-HealthKit/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/NativeScript","download_url":"https://codeload.github.com/NativeScript/sample-iOS-HealthKit/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":237163198,"owners_count":19265227,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-09-24T19:51:55.345Z","updated_at":"2025-10-19T16:30:45.058Z","avatar_url":"https://github.com/NativeScript.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Using the HealthKit SDK with NativeScript\nThis sample shows a simple use of the [iOS HealthKit APIs](https://developer.apple.com/healthkit/).\n\nIt is a very simple scenario but should help you out to get started if you want to work with this SDK.\nThe most important part of the sample is located in [main.js](https://github.com/NativeScript/sample-HealthKit/tree/master/app/components/main) file. Here is a snippet of code used to initialize the HealthKit SDK\n```javascript\nif (HKHealthStore.isHealthDataAvailable()) {\n        var weightType = HKObjectType.quantityTypeForIdentifier(HKQuantityTypeIdentifierBodyMass);\n        var writeDataTypes = NSSet.setWithObject(weightType);\n        var readDataTypes = NSSet.setWithObject(weightType);\n        var healthStore = HKHealthStore.new();\n        healthStore.requestAuthorizationToShareTypesReadTypesCompletion(readDataTypes, readDataTypes, function (success, error) {\n            if (!success) {\n...\n```\n\nTo run this example you must enable HealthKit in you xCode project:\n\n1. Add iOS platform to the application running the command: *tns platform add ios*\n2. Copy the NativeScript project files to the Xcode project that was created for the iOS platform running the command: *tns prepare ios* (needed only if you want to run the app from Xcode (step 5))\n3. Open the Xcode project file *.xcodeproject* (--MyNativeScriptProjectFolder--/platforms/iOS) in Xcode.\n4. Follow the steps from [Adding Capabilities article](https://developer.apple.com/library/ios/documentation/IDEs/Conceptual/AppDistributionGuide/AddingCapabilities/AddingCapabilities.html) to add HealthKit.\n5. Run the project from Xcode or run the following command: *tns run ios --emulator* to check how the project works.\n\nIf you have any questions about the sample please open an issue in our [issues repo](http://github.com/nativescript/nativescript/issues) or post directly in [NativeScript forums](https://discourse.nativescript.org/).\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnativescript%2Fsample-ios-healthkit","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnativescript%2Fsample-ios-healthkit","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnativescript%2Fsample-ios-healthkit/lists"}