Skip to content

Instantly share code, notes, and snippets.

let healthStore = HKHealthStore()
func applicationShouldRequestHealthAuthorization(_ application: UIApplication) {
print("AUTH ME")
self.healthStore.handleAuthorizationForExtension(completion: { (success, error) in })
}
@oviroa
oviroa / watch.swift
Last active May 27, 2017 00:34
HK Alert - watch OS
@IBAction func onStart() {
//vibrate
WKInterfaceDevice().play(WKHapticType.start)
self.askForHKPermission()
}
private func askForHKPermission () {
let healthStore = HKHealthStore()
//data to extract from HK
var readTypes = Set<HKObjectType>()