Skip to content

Instantly share code, notes, and snippets.

View thebookins's full-sized avatar

Paul Dickens thebookins

  • Sydney, NSW, Australia
View GitHub Profile
@phatblat
phatblat / AppDelegate.swift
Last active January 12, 2024 07:18
Example of creating HKObserverQuery and enabling background delivery for multiple HKObjectType
@UIApplicationMain
final class AppDelegate: UIResponder, UIApplicationDelegate {
let healthKitManager = HealthKitManager()
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
if onboardingComplete {
healthKitManager.requestAccessWithCompletion() { success, error in
if success { print("HealthKit access granted") }
else { print("Error requesting access to HealthKit: \(error)") }
}