To run the example project, clone the repo, and run pod install
from the Example directory first.
iOS 13 or later
You can integrate this framework into your project via Swift Package Manager (SwiftPM) or CocoaPods.
-
Open Package Manager Windows
- Open
Xcode
-> SelectMenu Bar
->File
->App Package Dependencies...
- Open
-
Find the package using the manager
- Select
Search Package URL
and typegit@github.com:awareframework/com.awareframework.ios.sensor.healthkit.git
- Select
-
Import the package into your target.
-
com_aware_ios_sensor_healthkit library into your source code.
import com_awareframework_ios_sensor_healthkit
- Turn on HealthKit capbility on Xcode
com.aware.ios.sensor.healthkit is available through CocoaPods.
- To install it, simply add the following line to your Podfile:
pod 'com.awareframework.ios.sensor.healthkit'
- com_aware_ios_sensor_healthkit library into your source code.
import com_awareframework_ios_sensor_healthkit
-
Turn on HealthKit capbility on Xcode
-
Add
NSHealthShareUsageDescription
into Info.plist
let sensor = HealthKitSensor.init(HealthKitSensor.Config().apply{config in
config.debug = true
config.sensorObserver = Observer()
config.isHeartRateFetch = true
})
sensor.start()
class Observer:HealthKitObserver {
func onHealthKitAuthorizationStatusChanged(success: Bool, error: Error?) {
// Your code here..
}
func onHeartRateDataChanged(data: [HealthKitHeartRateData]) {
// Your code here..
}
}
Yuuki Nishiyama (The University of Tokyo), nishiyama@csis.u-tokyo.ac.jp
Copyright (c) 2021 AWARE Mobile Context Instrumentation Middleware/Framework (http://www.awareframework.com)
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.