Skip to content

Instantly share code, notes, and snippets.

@max6363
Created May 8, 2018 18:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save max6363/9c14d8c1c6a8db4d9b77789f791a5075 to your computer and use it in GitHub Desktop.
Save max6363/9c14d8c1c6a8db4d9b77789f791a5075 to your computer and use it in GitHub Desktop.
#import <Foundation/Foundation.h>
@interface HealthKitManager : NSObject
// shared instance
+ (HealthKitManager *)sharedInstance;
@end
#import "HealthKitManager.h"
#import <HealthKit/HealthKit.h>
@interface HealthKitManager ()
@property (nonatomic, retain) HKHealthStore *healthStore;
@end
@implementation HealthKitManager
// shared instance
+ (HealthKitManager *)sharedInstance {
static HealthKitManager *instance = nil;
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
instance = [[HealthKitManager alloc] init];
});
return instance;
}
// init
- (id)init {
self = [super init];
if (self) {
self.healthStore = [[HKHealthStore alloc] init];
}
return self;
}
@end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment