Skip to content

Commit

Permalink
ENTITLEMENT & SWIFT SETUP
Browse files Browse the repository at this point in the history
  • Loading branch information
alfonsosn committed Nov 10, 2020
1 parent fccb63c commit 7f8844d
Show file tree
Hide file tree
Showing 7 changed files with 76 additions and 1 deletion.
4 changes: 4 additions & 0 deletions Healthkit.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
// App.js
import { NativeModules } from 'react-native'

console.log(NativeModules.Controller)
5 changes: 5 additions & 0 deletions ios/rnhealthkit-Bridging-Header.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
//
// Use this file to import your target's public headers that you would like to expose to Swift.
//

#import "React/RCTBridgeModule.h"
22 changes: 21 additions & 1 deletion ios/rnhealthkit.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@
3E461D99554A48A4959DE609 /* SplashScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = AA286B85B6C04FC6940260E9 /* SplashScreen.storyboard */; };
96905EF65AED1B983A6B3ABC /* libPods-rnhealthkit.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 58EEBF8E8E6FB1BC6CAF49B5 /* libPods-rnhealthkit.a */; };
BB2F792D24A3F905000567C9 /* Expo.plist in Resources */ = {isa = PBXBuildFile; fileRef = BB2F792C24A3F905000567C9 /* Expo.plist */; };
D99F1D1E2543441C0060214F /* Controller.swift in Sources */ = {isa = PBXBuildFile; fileRef = D99F1D1D2543441C0060214F /* Controller.swift */; };
D99F1D21254344740060214F /* Controller.m in Sources */ = {isa = PBXBuildFile; fileRef = D99F1D20254344740060214F /* Controller.m */; };
D99F1D252543493A0060214F /* HealthKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D99F1D242543493A0060214F /* HealthKit.framework */; };
/* End PBXBuildFile section */

/* Begin PBXFileReference section */
Expand All @@ -30,6 +33,11 @@
7A4D352CD337FB3A3BF06240 /* Pods-rnhealthkit.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-rnhealthkit.release.xcconfig"; path = "Target Support Files/Pods-rnhealthkit/Pods-rnhealthkit.release.xcconfig"; sourceTree = "<group>"; };
AA286B85B6C04FC6940260E9 /* SplashScreen.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; name = SplashScreen.storyboard; path = rnhealthkit/SplashScreen.storyboard; sourceTree = "<group>"; };
BB2F792C24A3F905000567C9 /* Expo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Expo.plist; sourceTree = "<group>"; };
D99F1D1C2543441C0060214F /* rnhealthkit-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "rnhealthkit-Bridging-Header.h"; sourceTree = "<group>"; };
D99F1D1D2543441C0060214F /* Controller.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = Controller.swift; path = rnhealthkit/Controller.swift; sourceTree = "<group>"; };
D99F1D20254344740060214F /* Controller.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; name = Controller.m; path = rnhealthkit/Controller.m; sourceTree = "<group>"; };
D99F1D232543493A0060214F /* rnhealthkit.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; name = rnhealthkit.entitlements; path = rnhealthkit/rnhealthkit.entitlements; sourceTree = "<group>"; };
D99F1D242543493A0060214F /* HealthKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = HealthKit.framework; path = System/Library/Frameworks/HealthKit.framework; sourceTree = SDKROOT; };
ED297162215061F000B7C4FE /* JavaScriptCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = JavaScriptCore.framework; path = System/Library/Frameworks/JavaScriptCore.framework; sourceTree = SDKROOT; };
ED2971642150620600B7C4FE /* JavaScriptCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = JavaScriptCore.framework; path = Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS12.0.sdk/System/Library/Frameworks/JavaScriptCore.framework; sourceTree = DEVELOPER_DIR; };
/* End PBXFileReference section */
Expand All @@ -40,6 +48,7 @@
buildActionMask = 2147483647;
files = (
96905EF65AED1B983A6B3ABC /* libPods-rnhealthkit.a in Frameworks */,
D99F1D252543493A0060214F /* HealthKit.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand All @@ -49,6 +58,7 @@
13B07FAE1A68108700A75B9A /* rnhealthkit */ = {
isa = PBXGroup;
children = (
D99F1D232543493A0060214F /* rnhealthkit.entitlements */,
BB2F792B24A3F905000567C9 /* Supporting */,
008F07F21AC5B25A0029DE68 /* main.jsbundle */,
13B07FAF1A68108700A75B9A /* AppDelegate.h */,
Expand All @@ -58,13 +68,17 @@
13B07FB11A68108700A75B9A /* LaunchScreen.xib */,
13B07FB71A68108700A75B9A /* main.m */,
AA286B85B6C04FC6940260E9 /* SplashScreen.storyboard */,
D99F1D1D2543441C0060214F /* Controller.swift */,
D99F1D20254344740060214F /* Controller.m */,
D99F1D1C2543441C0060214F /* rnhealthkit-Bridging-Header.h */,
);
name = rnhealthkit;
sourceTree = "<group>";
};
2D16E6871FA4F8E400B85C8A /* Frameworks */ = {
isa = PBXGroup;
children = (
D99F1D242543493A0060214F /* HealthKit.framework */,
ED297162215061F000B7C4FE /* JavaScriptCore.framework */,
ED2971642150620600B7C4FE /* JavaScriptCore.framework */,
58EEBF8E8E6FB1BC6CAF49B5 /* libPods-rnhealthkit.a */,
Expand Down Expand Up @@ -152,7 +166,7 @@
LastUpgradeCheck = 1130;
TargetAttributes = {
13B07F861A680F5B00A75B9A = {
LastSwiftMigration = 1120;
LastSwiftMigration = 1200;
};
};
};
Expand Down Expand Up @@ -269,8 +283,10 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
D99F1D1E2543441C0060214F /* Controller.swift in Sources */,
13B07FBC1A68108700A75B9A /* AppDelegate.m in Sources */,
13B07FC11A68108700A75B9A /* main.m in Sources */,
D99F1D21254344740060214F /* Controller.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand All @@ -295,6 +311,7 @@
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = rnhealthkit/rnhealthkit.entitlements;
CURRENT_PROJECT_VERSION = 1;
ENABLE_BITCODE = NO;
"EXCLUDED_ARCHS[sdk=iphonesimulator*]" = arm64;
Expand All @@ -312,6 +329,7 @@
);
PRODUCT_BUNDLE_IDENTIFIER = org.name.rnhealthkit;
PRODUCT_NAME = rnhealthkit;
SWIFT_OBJC_BRIDGING_HEADER = "rnhealthkit-Bridging-Header.h";
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 5.0;
VERSIONING_SYSTEM = "apple-generic";
Expand All @@ -324,6 +342,7 @@
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = rnhealthkit/rnhealthkit.entitlements;
CURRENT_PROJECT_VERSION = 1;
"EXCLUDED_ARCHS[sdk=iphonesimulator*]" = arm64;
INFOPLIST_FILE = rnhealthkit/Info.plist;
Expand All @@ -336,6 +355,7 @@
);
PRODUCT_BUNDLE_IDENTIFIER = org.name.rnhealthkit;
PRODUCT_NAME = rnhealthkit;
SWIFT_OBJC_BRIDGING_HEADER = "rnhealthkit-Bridging-Header.h";
SWIFT_VERSION = 5.0;
VERSIONING_SYSTEM = "apple-generic";
};
Expand Down
14 changes: 14 additions & 0 deletions ios/rnhealthkit/Controller.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
//
// Controller.m
// rnhealthkit
//
// Created by Alfonso Enriquez-Castro on 10/23/20.
//

#import "React/RCTBridgeModule.h"

@interface RCT_EXTERN_MODULE(Controller, NSObject)

RCT_EXTERN_METHOD(requestAuthorization)

@end
18 changes: 18 additions & 0 deletions ios/rnhealthkit/Controller.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@

// Controller.swift
// rnhealthkit

import Foundation
import HealthKit

@objc(Controller)
class Controller: NSObject {

let healthStore = HKHealthStore()

@objc
static func requiresMainQueueSetup() -> Bool {
return true
}
}

4 changes: 4 additions & 0 deletions ios/rnhealthkit/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@
</dict>
</dict>
</dict>
<key>NSHealthShareUsageDescription</key>
<string>Read and understand health data</string>
<key>NSHealthUpdateUsageDescription</key>
<string>Share workout data with other apps</string>
<key>NSLocationWhenInUseUsageDescription</key>
<string></string>
<key>UILaunchStoryboardName</key>
Expand Down
10 changes: 10 additions & 0 deletions ios/rnhealthkit/rnhealthkit.entitlements
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>com.apple.developer.healthkit</key>
<true/>
<key>com.apple.developer.healthkit.access</key>
<array/>
</dict>
</plist>

0 comments on commit 7f8844d

Please sign in to comment.