{"id":18638345,"url":"https://github.com/kitasuke/cardio","last_synced_at":"2025-04-11T10:31:20.637Z","repository":{"id":95188046,"uuid":"43640229","full_name":"kitasuke/Cardio","owner":"kitasuke","description":"Simple HealthKit wrapper for workout in watchOS 2","archived":false,"fork":false,"pushed_at":"2016-11-30T05:50:13.000Z","size":90,"stargazers_count":81,"open_issues_count":1,"forks_count":4,"subscribers_count":6,"default_branch":"master","last_synced_at":"2023-10-20T21:00:50.712Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/kitasuke.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2015-10-04T15:03:50.000Z","updated_at":"2023-10-20T21:01:28.659Z","dependencies_parsed_at":"2023-06-12T09:15:19.827Z","dependency_job_id":null,"html_url":"https://github.com/kitasuke/Cardio","commit_stats":null,"previous_names":[],"tags_count":10,"template":null,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kitasuke%2FCardio","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kitasuke%2FCardio/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kitasuke%2FCardio/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kitasuke%2FCardio/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kitasuke","download_url":"https://codeload.github.com/kitasuke/Cardio/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":223466428,"owners_count":17149770,"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-11-07T05:40:55.466Z","updated_at":"2024-11-07T05:40:55.950Z","avatar_url":"https://github.com/kitasuke.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Carthage compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/kitasuke/Cardio)\n\n# Cardio\nSimple HealthKit wrapper for workout in watchOS 3\n\nHow it works in demo project  \n\u003cimg src=\"https://raw.githubusercontent.com/wiki/kitasuke/Cardio/images/demo1.gif\" width=\"144\" height=\"168\"\u003e\n\n## Features\n\n- Super simple to access HealthKit\n- Cuztomizable preferences\n- Well-designed for workout app\n- Easy way to save workout data in HealthKit\n\n## Usage\n\n- Extend `Context` protocol and set your favorite types\n```swift\npublic protocol Context {\n    var activityType: HKWorkoutActivityType { get }\n    var locationType: HKWorkoutSessionLocationType { get }\n\n    var distanceUnit: HKUnit { get }\n    var activeEnergyUnit: HKUnit { get }\n    var heartRateUnit: HKUnit { get }\n\n    var distanceType: HKQuantityType { get }\n    var activeEnergyType: HKQuantityType { get }\n    var heartRateType: HKQuantityType { get }\n\n    var shareIdentifiers: [String] { get }\n    var readIdentifiers: [String] { get }\n}\n```\n\n- Initialize `Cardio` with context\n```swift\nlet cardio = try? Cardio(context: context)\n```\n\n- Authorize HealthKit to access\n```swift\nif !cardio.isAuthorized {\n    cardio.authorize { result in\n    }\n}\n```\n\n- Set update handler\n```swift\ncardio.distanceHandler = { distance, total in\n}\n\ncardio.activeEnergyHandler = { activeEnergy, total in\n}\n\ncardio.heartRateHandler = { heartRate, average in\n}\n```\n\n- Start your workout session\n```swift\ncardio.start { result in\n}\n```\n- End your workout session\n```swift\ncardio.end { result in\n}\n```\n- Pause your workout\n```swift\ncardio.pause()\n```\n- Resume your workout\n```swift\ncardio.resume()\n```\n\n- Save your workout in HealthKit\n```swift\ncardio.save { result in\n}\n```\n\nSee more detail in Demo project\n\n## Requirements\n\nwatchOS 3.0+  \nSwift 3.0+\n\n## Installation\n\n**Add HealthKit entitlement in Capabilities tab for your both containing app target and WatchKit extension target**\n\n### Carthage\nCardio is available through [Carthage](https://github.com/Carthage/Carthage).\n\nTo install Cardio into your Xcode project using Carthage, specify it in your Cartfile:\n\n```ruby\ngithub \"kitasuke/Cardio\"\n```\n\nThen, run `carthage update`\n\nYou can see `Cardio.framework` and `Result.framework` in `Carthage/Build/iOs` and `Carthage/Build/watchOS/` now, so drag and drop them to `Embedded Binaries` in General menu tab for your iOS app and WatchKit Extension.\n\nIn case you haven't installed Carthage yet, run the following command\n\n```ruby\n$ brew update\n$ brew install carthage\n```\n\n### Manual\n\nCopy all the files in `Cardio` and `Carthage/Checkouts/Result/Result` directory into your WatchKit Extension.\n\n\n## License\n\nCardio is available under the MIT license. See the [LICENSE](https://github.com/kitasuke/Cardio/blob/master/LICENSE) file for more info.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkitasuke%2Fcardio","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkitasuke%2Fcardio","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkitasuke%2Fcardio/lists"}