Repository: thomaspaulmann/HeartControl
Branch: master
Commit: 020c823194e7
Files: 30
Total size: 62.8 KB
Directory structure:
gitextract_yi781vpn/
├── .gitignore
├── Design/
│ └── heart-control.sketch
├── Heart Control/
│ ├── AppDelegate.swift
│ ├── Assets.xcassets/
│ │ ├── AppIcon.appiconset/
│ │ │ └── Contents.json
│ │ ├── Contents.json
│ │ └── Heart Control.imageset/
│ │ └── Contents.json
│ ├── Base.lproj/
│ │ ├── LaunchScreen.storyboard
│ │ └── Main.storyboard
│ ├── Heart Control.entitlements
│ ├── Info.plist
│ └── ViewController.swift
├── Heart Control WatchKit App/
│ ├── Assets.xcassets/
│ │ └── AppIcon.appiconset/
│ │ └── Contents.json
│ ├── Base.lproj/
│ │ └── Interface.storyboard
│ └── Info.plist
├── Heart Control WatchKit Extension/
│ ├── Assets.xcassets/
│ │ └── Complication.complicationset/
│ │ ├── Circular.imageset/
│ │ │ └── Contents.json
│ │ ├── Contents.json
│ │ ├── Modular.imageset/
│ │ │ └── Contents.json
│ │ └── Utilitarian.imageset/
│ │ └── Contents.json
│ ├── AuthorizationManger.swift
│ ├── ExtensionDelegate.swift
│ ├── HKUnit+BeatsPerMinute.swift
│ ├── Heart Control WatchKit Extension.entitlements
│ ├── HeartRate.swift
│ ├── HeartRateManager.swift
│ ├── Info.plist
│ ├── InterfaceController.swift
│ └── WorkoutManager.swift
├── Heart Control.xcodeproj/
│ ├── project.pbxproj
│ └── project.xcworkspace/
│ └── contents.xcworkspacedata
└── README.md
================================================
FILE CONTENTS
================================================
================================================
FILE: .gitignore
================================================
# Build generated
build/
DerivedData/
# Various settings
*.pbxuser
!default.pbxuser
*.mode1v3
!default.mode1v3
*.mode2v3
!default.mode2v3
*.perspectivev3
!default.perspectivev3
xcuserdata/
# Other
.DS_Store
*.moved-aside
*.xcuserstate
# Obj-C/Swift specific
*.hmap
*.ipa
# Playgrounds
timeline.xctimeline
playground.xcworkspace
================================================
FILE: Heart Control/AppDelegate.swift
================================================
//
// AppDelegate.swift
// Heart Control
//
// Created by Thomas Paul Mann on 01/08/16.
// Copyright © 2016 Thomas Paul Mann. All rights reserved.
//
import UIKit
import HealthKit
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
// MARK: - Properties
private let healthStore = HKHealthStore()
var window: UIWindow?
// MARK: - Lifecycle
private func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
return true
}
func applicationShouldRequestHealthAuthorization(_ application: UIApplication) {
// Authorize access to health data for watch.
healthStore.handleAuthorizationForExtension { success, error in
print(success)
}
}
}
================================================
FILE: Heart Control/Assets.xcassets/AppIcon.appiconset/Contents.json
================================================
{
"images" : [
{
"idiom" : "iphone",
"size" : "20x20",
"scale" : "2x"
},
{
"idiom" : "iphone",
"size" : "20x20",
"scale" : "3x"
},
{
"size" : "29x29",
"idiom" : "iphone",
"filename" : "Icon-App-29x29@1x.png",
"scale" : "1x"
},
{
"size" : "29x29",
"idiom" : "iphone",
"filename" : "Icon-App-29x29@2x.png",
"scale" : "2x"
},
{
"idiom" : "iphone",
"size" : "29x29",
"scale" : "3x"
},
{
"idiom" : "iphone",
"size" : "40x40",
"scale" : "2x"
},
{
"size" : "40x40",
"idiom" : "iphone",
"filename" : "Icon-App-40x40@3x.png",
"scale" : "3x"
},
{
"size" : "60x60",
"idiom" : "iphone",
"filename" : "Icon-App-60x60@2x.png",
"scale" : "2x"
},
{
"idiom" : "iphone",
"size" : "60x60",
"scale" : "3x"
},
{
"idiom" : "ipad",
"size" : "20x20",
"scale" : "1x"
},
{
"idiom" : "ipad",
"size" : "20x20",
"scale" : "2x"
},
{
"idiom" : "ipad",
"size" : "29x29",
"scale" : "1x"
},
{
"idiom" : "ipad",
"size" : "29x29",
"scale" : "2x"
},
{
"size" : "40x40",
"idiom" : "ipad",
"filename" : "Icon-App-40x40@1x.png",
"scale" : "1x"
},
{
"idiom" : "ipad",
"size" : "40x40",
"scale" : "2x"
},
{
"size" : "76x76",
"idiom" : "ipad",
"filename" : "Icon-App-76x76@1x.png",
"scale" : "1x"
},
{
"size" : "76x76",
"idiom" : "ipad",
"filename" : "Icon-App-76x76@2x.png",
"scale" : "2x"
},
{
"size" : "83.5x83.5",
"idiom" : "ipad",
"filename" : "Icon-App-83.5x83.5@2x.png",
"scale" : "2x"
},
{
"idiom" : "car",
"size" : "60x60",
"scale" : "2x"
},
{
"size" : "60x60",
"idiom" : "car",
"filename" : "Icon-App-60x60@3x.png",
"scale" : "3x"
},
{
"size" : "24x24",
"idiom" : "watch",
"scale" : "2x",
"role" : "notificationCenter",
"subtype" : "38mm"
},
{
"size" : "27.5x27.5",
"idiom" : "watch",
"scale" : "2x",
"role" : "notificationCenter",
"subtype" : "42mm"
},
{
"size" : "29x29",
"idiom" : "watch",
"role" : "companionSettings",
"scale" : "2x"
},
{
"size" : "29x29",
"idiom" : "watch",
"filename" : "Icon-App-29x29@3x.png",
"role" : "companionSettings",
"scale" : "3x"
},
{
"size" : "40x40",
"idiom" : "watch",
"filename" : "Icon-App-40x40@2x.png",
"scale" : "2x",
"role" : "appLauncher",
"subtype" : "38mm"
},
{
"size" : "44x44",
"idiom" : "watch",
"scale" : "2x",
"role" : "longLook",
"subtype" : "42mm"
},
{
"size" : "86x86",
"idiom" : "watch",
"scale" : "2x",
"role" : "quickLook",
"subtype" : "38mm"
},
{
"size" : "98x98",
"idiom" : "watch",
"scale" : "2x",
"role" : "quickLook",
"subtype" : "42mm"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
================================================
FILE: Heart Control/Assets.xcassets/Contents.json
================================================
{
"info" : {
"version" : 1,
"author" : "xcode"
}
}
================================================
FILE: Heart Control/Assets.xcassets/Heart Control.imageset/Contents.json
================================================
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "Heart Control.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
================================================
FILE: Heart Control/Base.lproj/LaunchScreen.storyboard
================================================
================================================
FILE: Heart Control/Base.lproj/Main.storyboard
================================================
================================================
FILE: Heart Control/Heart Control.entitlements
================================================
com.apple.developer.healthkit
================================================
FILE: Heart Control/Info.plist
================================================
CFBundleDevelopmentRegion
en
CFBundleExecutable
$(EXECUTABLE_NAME)
CFBundleIdentifier
$(PRODUCT_BUNDLE_IDENTIFIER)
CFBundleInfoDictionaryVersion
6.0
CFBundleName
$(PRODUCT_NAME)
CFBundlePackageType
APPL
CFBundleShortVersionString
1.0
CFBundleSignature
????
CFBundleVersion
1
LSRequiresIPhoneOS
UILaunchStoryboardName
LaunchScreen
UIMainStoryboardFile
Main
UIRequiredDeviceCapabilities
armv7
healthkit
UISupportedInterfaceOrientations
UIInterfaceOrientationPortrait
NSHealthShareUsageDescription
Read your Heart Rate and present it on your Apple Watch.
================================================
FILE: Heart Control/ViewController.swift
================================================
//
// ViewController.swift
// Heart Control
//
// Created by Thomas Paul Mann on 01/08/16.
// Copyright © 2016 Thomas Paul Mann. All rights reserved.
//
import UIKit
class ViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
}
================================================
FILE: Heart Control WatchKit App/Assets.xcassets/AppIcon.appiconset/Contents.json
================================================
{
"images" : [
{
"size" : "29x29",
"idiom" : "iphone",
"filename" : "Icon-29@2x.png",
"scale" : "2x"
},
{
"size" : "24x24",
"idiom" : "watch",
"filename" : "Icon-24@2x.png",
"scale" : "2x",
"role" : "notificationCenter",
"subtype" : "38mm"
},
{
"size" : "27.5x27.5",
"idiom" : "watch",
"filename" : "Icon-27.5@2x.png",
"scale" : "2x",
"role" : "notificationCenter",
"subtype" : "42mm"
},
{
"size" : "29x29",
"idiom" : "watch",
"role" : "companionSettings",
"scale" : "2x"
},
{
"size" : "29x29",
"idiom" : "watch",
"filename" : "Icon-29@3x.png",
"role" : "companionSettings",
"scale" : "3x"
},
{
"size" : "40x40",
"idiom" : "watch",
"filename" : "Icon-40@2x.png",
"scale" : "2x",
"role" : "appLauncher",
"subtype" : "38mm"
},
{
"size" : "44x44",
"idiom" : "watch",
"filename" : "Icon-44@2x.png",
"scale" : "2x",
"role" : "longLook",
"subtype" : "42mm"
},
{
"size" : "86x86",
"idiom" : "watch",
"filename" : "Icon-86@2x.png",
"scale" : "2x",
"role" : "quickLook",
"subtype" : "38mm"
},
{
"size" : "98x98",
"idiom" : "watch",
"filename" : "Icon-98@2x.png",
"scale" : "2x",
"role" : "quickLook",
"subtype" : "42mm"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
================================================
FILE: Heart Control WatchKit App/Base.lproj/Interface.storyboard
================================================
================================================
FILE: Heart Control WatchKit App/Info.plist
================================================
CFBundleDevelopmentRegion
en
CFBundleDisplayName
Heart Control
CFBundleExecutable
$(EXECUTABLE_NAME)
CFBundleIdentifier
$(PRODUCT_BUNDLE_IDENTIFIER)
CFBundleInfoDictionaryVersion
6.0
CFBundleName
$(PRODUCT_NAME)
CFBundlePackageType
APPL
CFBundleShortVersionString
1.0
CFBundleSignature
????
CFBundleVersion
1
UISupportedInterfaceOrientations
UIInterfaceOrientationPortrait
UIInterfaceOrientationPortraitUpsideDown
WKCompanionAppBundleIdentifier
com.thomaspaulmann.Heart-Control
WKWatchKitApp
================================================
FILE: Heart Control WatchKit Extension/Assets.xcassets/Complication.complicationset/Circular.imageset/Contents.json
================================================
{
"images" : [
{
"idiom" : "watch",
"scale" : "2x"
},
{
"idiom" : "watch",
"scale" : "2x",
"screen-width" : "<=145"
},
{
"idiom" : "watch",
"scale" : "2x",
"screen-width" : ">145"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
================================================
FILE: Heart Control WatchKit Extension/Assets.xcassets/Complication.complicationset/Contents.json
================================================
{
"assets" : [
{
"idiom" : "watch",
"filename" : "Circular.imageset",
"role" : "circular"
},
{
"idiom" : "watch",
"filename" : "Modular.imageset",
"role" : "modular"
},
{
"idiom" : "watch",
"filename" : "Utilitarian.imageset",
"role" : "utilitarian"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
================================================
FILE: Heart Control WatchKit Extension/Assets.xcassets/Complication.complicationset/Modular.imageset/Contents.json
================================================
{
"images" : [
{
"idiom" : "watch",
"scale" : "2x"
},
{
"idiom" : "watch",
"scale" : "2x",
"screen-width" : "<=145"
},
{
"idiom" : "watch",
"scale" : "2x",
"screen-width" : ">145"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
================================================
FILE: Heart Control WatchKit Extension/Assets.xcassets/Complication.complicationset/Utilitarian.imageset/Contents.json
================================================
{
"images" : [
{
"idiom" : "watch",
"scale" : "2x"
},
{
"idiom" : "watch",
"scale" : "2x",
"screen-width" : "<=145"
},
{
"idiom" : "watch",
"scale" : "2x",
"screen-width" : ">145"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
================================================
FILE: Heart Control WatchKit Extension/AuthorizationManger.swift
================================================
//
// HKAuthorizationManger.swift
// Heart Control
//
// Created by Thomas Paul Mann on 07/08/16.
// Copyright © 2016 Thomas Paul Mann. All rights reserved.
//
import HealthKit
class AuthorizationManager {
static func requestAuthorization(completionHandler: ((_ success: Bool) -> Void)) {
// Create health store.
let healthStore = HKHealthStore()
// Check if there is health data available.
if (!HKHealthStore.isHealthDataAvailable()) {
print("No health data is available.")
completionHandler(false)
return
}
// Create quantity type for heart rate.
guard let heartRateQuantityType = HKQuantityType.quantityType(forIdentifier: .heartRate) else {
print("Unable to create quantity type for heart rate.")
completionHandler(false)
return
}
// Request authorization to read heart rate data.
healthStore.requestAuthorization(toShare: nil, read: [heartRateQuantityType]) { (success, error) -> Void in
// If there is an error, do nothing.
guard error == nil else {
print(error)
completionHandler(false)
return
}
// Delegate success.
completionHandler(success)
}
}
}
================================================
FILE: Heart Control WatchKit Extension/ExtensionDelegate.swift
================================================
//
// ExtensionDelegate.swift
// Heart Control WatchKit Extension
//
// Created by Thomas Paul Mann on 01/08/16.
// Copyright © 2016 Thomas Paul Mann. All rights reserved.
//
import WatchKit
class ExtensionDelegate: NSObject, WKExtensionDelegate {
func applicationDidFinishLaunching() {
// Perform any final initialization of your application.
}
func applicationDidBecomeActive() {
// Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
}
func applicationWillResignActive() {
// Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
// Use this method to pause ongoing tasks, disable timers, etc.
}
func handle(_ backgroundTasks: Set) {
// Sent when the system needs to launch the application in the background to process tasks. Tasks arrive in a set, so loop through and process each one.
backgroundTasks.forEach { (task) in
// Process the background task
// Be sure to complete each task when finished processing.
task.setTaskCompleted()
}
}
}
================================================
FILE: Heart Control WatchKit Extension/HKUnit+BeatsPerMinute.swift
================================================
//
// HKUnit+BeatsPerMinute.swift
// Heart Control
//
// Created by Thomas Paul Mann on 01/08/16.
// Copyright © 2016 Thomas Paul Mann. All rights reserved.
//
import HealthKit
extension HKUnit {
static func beatsPerMinute() -> HKUnit {
return HKUnit.count().unitDivided(by: HKUnit.minute())
}
}
================================================
FILE: Heart Control WatchKit Extension/Heart Control WatchKit Extension.entitlements
================================================
com.apple.developer.healthkit
================================================
FILE: Heart Control WatchKit Extension/HeartRate.swift
================================================
//
// HeartRate.swift
// Heart Control
//
// Created by Thomas Paul Mann on 07/08/16.
// Copyright © 2016 Thomas Paul Mann. All rights reserved.
//
import Foundation
struct HeartRate {
let timestamp: Date
let bpm: Double
}
================================================
FILE: Heart Control WatchKit Extension/HeartRateManager.swift
================================================
//
// HeartRateManager.swift
// Heart Control
//
// Created by Thomas Paul Mann on 01/08/16.
// Copyright © 2016 Thomas Paul Mann. All rights reserved.
//
import HealthKit
typealias HKQueryUpdateHandler = ((HKAnchoredObjectQuery, [HKSample]?, [HKDeletedObject]?, HKQueryAnchor?, Error?) -> Swift.Void)
protocol HeartRateManagerDelegate: class {
func heartRate(didChangeTo newHeartRate: HeartRate)
}
class HeartRateManager {
// MARK: - Properties
private let healthStore = HKHealthStore()
weak var delegate: HeartRateManagerDelegate?
private var activeQueries = [HKQuery]()
// MARK: - Initialization
init() {
// Request authorization to read heart rate data.
AuthorizationManager.requestAuthorization { (success) in
// TODO: Export error.
print(success)
}
}
// MARK: - Public API
func start() {
// Configure heart rate quantity type.
guard let quantityType = HKObjectType.quantityType(forIdentifier: .heartRate) else { return }
// Create query to receive continiuous heart rate samples.
let datePredicate = HKQuery.predicateForSamples(withStart: Date(), end: nil, options: .strictStartDate)
let devicePredicate = HKQuery.predicateForObjects(from: [HKDevice.local()])
let queryPredicate = NSCompoundPredicate(andPredicateWithSubpredicates:[datePredicate, devicePredicate])
let updateHandler: HKQueryUpdateHandler = { [weak self] query, samples, deletedObjects, queryAnchor, error in
if let quantitySamples = samples as? [HKQuantitySample] {
self?.process(samples: quantitySamples)
}
}
let query = HKAnchoredObjectQuery(type: quantityType,
predicate: queryPredicate,
anchor: nil,
limit: HKObjectQueryNoLimit,
resultsHandler: updateHandler)
query.updateHandler = updateHandler
// Execute the heart rate query.
healthStore.execute(query)
// Remember all active Queries to stop them later.
activeQueries.append(query)
}
func stop() {
// Stop all active queries.
activeQueries.forEach { healthStore.stop($0) }
activeQueries.removeAll()
}
// MARK: - Process
private func process(samples: [HKQuantitySample]) {
// Process every single sample.
samples.forEach { process(sample: $0) }
}
private func process(sample: HKQuantitySample) {
// If sample is not a heart rate sample, then do nothing.
if (sample.quantityType != HKObjectType.quantityType(forIdentifier: .heartRate)) {
return
}
// If sample is not compatible with beats per minute, then do nothing.
if (!sample.quantity.is(compatibleWith: HKUnit.beatsPerMinute())) {
return
}
// Extract information from sample.
let timestamp = sample.endDate
let count = sample.quantity.doubleValue(for: .beatsPerMinute())
// Delegate new heart rate.
let newHeartRate = HeartRate(timestamp: timestamp, bpm: count)
delegate?.heartRate(didChangeTo: newHeartRate)
}
}
================================================
FILE: Heart Control WatchKit Extension/Info.plist
================================================
CFBundleDevelopmentRegion
en
CFBundleDisplayName
Heart Control WatchKit Extension
CFBundleExecutable
$(EXECUTABLE_NAME)
CFBundleIdentifier
$(PRODUCT_BUNDLE_IDENTIFIER)
CFBundleInfoDictionaryVersion
6.0
CFBundleName
$(PRODUCT_NAME)
CFBundlePackageType
XPC!
CFBundleShortVersionString
1.0
CFBundleSignature
????
CFBundleVersion
1
NSExtension
NSExtensionAttributes
WKAppBundleIdentifier
com.thomaspaulmann.Heart-Control.watchkitapp
NSExtensionPointIdentifier
com.apple.watchkit
UIRequiredDeviceCapabilities
healthkit
WKBackgroundModes
workout-processing
WKExtensionDelegateClassName
$(PRODUCT_MODULE_NAME).ExtensionDelegate
================================================
FILE: Heart Control WatchKit Extension/InterfaceController.swift
================================================
//
// InterfaceController.swift
// Heart Control WatchKit Extension
//
// Created by Thomas Paul Mann on 01/08/16.
// Copyright © 2016 Thomas Paul Mann. All rights reserved.
//
import WatchKit
class InterfaceController: WKInterfaceController {
// MARK: - Outlets
@IBOutlet var heartRateLabel: WKInterfaceLabel!
@IBOutlet var controlButton: WKInterfaceButton!
// MARK: - Properties
private let workoutManager = WorkoutManager()
// MARK: - Lifecycle
override func willActivate() {
super.willActivate()
// Configure workout manager.
workoutManager.delegate = self
}
// MARK: - Actions
@IBAction func didTapButton() {
switch workoutManager.state {
case .started:
// Stop current workout.
workoutManager.stop()
break
case .stopped:
// Start new workout.
workoutManager.start()
break
}
}
}
// MARK: - Workout Manager Delegate
extension InterfaceController: WorkoutManagerDelegate {
func workoutManager(_ manager: WorkoutManager, didChangeStateTo newState: WorkoutState) {
// Update title of control button.
controlButton.setTitle(newState.actionText())
}
func workoutManager(_ manager: WorkoutManager, didChangeHeartRateTo newHeartRate: HeartRate) {
// Update heart rate label.
heartRateLabel.setText(String(format: "%.0f", newHeartRate.bpm))
}
}
================================================
FILE: Heart Control WatchKit Extension/WorkoutManager.swift
================================================
//
// WorkoutManager.swift
// Heart Control
//
// Created by Thomas Paul Mann on 01/08/16.
// Copyright © 2016 Thomas Paul Mann. All rights reserved.
//
import HealthKit
enum WorkoutState {
case started, stopped
}
extension WorkoutState {
func actionText() -> String {
switch self {
case .started:
return "Stop"
case .stopped:
return "Start"
}
}
}
protocol WorkoutManagerDelegate: class {
func workoutManager(_ manager: WorkoutManager, didChangeStateTo newState: WorkoutState)
func workoutManager(_ manager: WorkoutManager, didChangeHeartRateTo newHeartRate: HeartRate)
}
class WorkoutManager: NSObject {
// MARK: - Properties
private let healthStore = HKHealthStore()
fileprivate let heartRateManager = HeartRateManager()
weak var delegate: WorkoutManagerDelegate?
private(set) var state: WorkoutState = .stopped
private var session: HKWorkoutSession?
// MARK: - Initialization
override init() {
super.init()
// Configure heart rate manager.
heartRateManager.delegate = self
}
// MARK: - Public API
func start() {
// If we have already started the workout, then do nothing.
if (session != nil) {
// Another workout is running.
return
}
// Configure the workout session.
let workoutConfiguration = HKWorkoutConfiguration()
workoutConfiguration.activityType = .other
workoutConfiguration.locationType = .indoor
// Create workout session.
do {
session = try HKWorkoutSession(configuration: workoutConfiguration)
session!.delegate = self
} catch {
fatalError("Unable to create Workout Session!")
}
// Start workout session.
healthStore.start(session!)
// Update state to started and inform delegates.
state = .started
delegate?.workoutManager(self, didChangeStateTo: state)
}
func stop() {
// If we have already stopped the workout, then do nothing.
if (session == nil) {
return
}
// Stop querying heart rate.
heartRateManager.stop()
// Stop the workout session.
healthStore.end(session!)
// Clear the workout session.
session = nil
// Update state to stopped and inform delegates.
state = .stopped
delegate?.workoutManager(self, didChangeStateTo: state)
}
}
// MARK: - Workout Session Delegate
extension WorkoutManager: HKWorkoutSessionDelegate {
func workoutSession(_ workoutSession: HKWorkoutSession, didChangeTo toState: HKWorkoutSessionState, from fromState: HKWorkoutSessionState, date: Date) {
switch toState {
case .running:
if fromState == .notStarted {
heartRateManager.start()
}
default:
break
}
}
func workoutSession(_ workoutSession: HKWorkoutSession, didFailWithError error: Error) {
fatalError(error.localizedDescription)
}
func workoutSession(_ workoutSession: HKWorkoutSession, didGenerate event: HKWorkoutEvent) {
print("Did generate \(event)")
}
}
// MARK: - Heart Rate Delegate
extension WorkoutManager: HeartRateManagerDelegate {
func heartRate(didChangeTo newHeartRate: HeartRate) {
delegate?.workoutManager(self, didChangeHeartRateTo: newHeartRate)
}
}
================================================
FILE: Heart Control.xcodeproj/project.pbxproj
================================================
// !$*UTF8*$!
{
archiveVersion = 1;
classes = {
};
objectVersion = 46;
objects = {
/* Begin PBXBuildFile section */
BE25AFEB1D4F33B100DAF094 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = BE25AFEA1D4F33B100DAF094 /* AppDelegate.swift */; };
BE25AFED1D4F33B100DAF094 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = BE25AFEC1D4F33B100DAF094 /* ViewController.swift */; };
BE25AFF01D4F33B100DAF094 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = BE25AFEE1D4F33B100DAF094 /* Main.storyboard */; };
BE25AFF21D4F33B100DAF094 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = BE25AFF11D4F33B100DAF094 /* Assets.xcassets */; };
BE25AFF51D4F33B100DAF094 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = BE25AFF31D4F33B100DAF094 /* LaunchScreen.storyboard */; };
BE25AFFA1D4F33B100DAF094 /* Heart Control WatchKit App.app in Embed Watch Content */ = {isa = PBXBuildFile; fileRef = BE25AFF91D4F33B100DAF094 /* Heart Control WatchKit App.app */; };
BE25B0001D4F33B100DAF094 /* Interface.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = BE25AFFE1D4F33B100DAF094 /* Interface.storyboard */; };
BE25B0021D4F33B100DAF094 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = BE25B0011D4F33B100DAF094 /* Assets.xcassets */; };
BE25B0091D4F33B100DAF094 /* Heart Control WatchKit Extension.appex in Embed App Extensions */ = {isa = PBXBuildFile; fileRef = BE25B0081D4F33B100DAF094 /* Heart Control WatchKit Extension.appex */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; };
BE25B00E1D4F33B100DAF094 /* InterfaceController.swift in Sources */ = {isa = PBXBuildFile; fileRef = BE25B00D1D4F33B100DAF094 /* InterfaceController.swift */; };
BE25B0101D4F33B100DAF094 /* ExtensionDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = BE25B00F1D4F33B100DAF094 /* ExtensionDelegate.swift */; };
BE25B0121D4F33B100DAF094 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = BE25B0111D4F33B100DAF094 /* Assets.xcassets */; };
BE3FDBDC1D576B8D009165A8 /* HeartRate.swift in Sources */ = {isa = PBXBuildFile; fileRef = BE3FDBDB1D576B8D009165A8 /* HeartRate.swift */; };
BE496A231D4F4D9A00C82C4F /* WorkoutManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = BE496A221D4F4D9A00C82C4F /* WorkoutManager.swift */; };
BE5AEE171D4F7CED0027C49C /* HKUnit+BeatsPerMinute.swift in Sources */ = {isa = PBXBuildFile; fileRef = BE5AEE161D4F7CED0027C49C /* HKUnit+BeatsPerMinute.swift */; };
BE7070091D57A13D00E41B95 /* HealthKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = BE7070081D57A13D00E41B95 /* HealthKit.framework */; };
BE70700B1D57A14300E41B95 /* HealthKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = BE70700A1D57A14300E41B95 /* HealthKit.framework */; };
BE70700D1D57A29500E41B95 /* AuthorizationManger.swift in Sources */ = {isa = PBXBuildFile; fileRef = BE70700C1D57A29500E41B95 /* AuthorizationManger.swift */; };
BEB5C5BB1D4F656D00BBF490 /* HeartRateManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = BEB5C5BA1D4F656D00BBF490 /* HeartRateManager.swift */; };
/* End PBXBuildFile section */
/* Begin PBXContainerItemProxy section */
BE25AFFB1D4F33B100DAF094 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = BE25AFDF1D4F33B000DAF094 /* Project object */;
proxyType = 1;
remoteGlobalIDString = BE25AFF81D4F33B100DAF094;
remoteInfo = "Heart Control WatchKit App";
};
BE25B00A1D4F33B100DAF094 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = BE25AFDF1D4F33B000DAF094 /* Project object */;
proxyType = 1;
remoteGlobalIDString = BE25B0071D4F33B100DAF094;
remoteInfo = "Heart Control WatchKit Extension";
};
/* End PBXContainerItemProxy section */
/* Begin PBXCopyFilesBuildPhase section */
BE25B0191D4F33B100DAF094 /* Embed App Extensions */ = {
isa = PBXCopyFilesBuildPhase;
buildActionMask = 2147483647;
dstPath = "";
dstSubfolderSpec = 13;
files = (
BE25B0091D4F33B100DAF094 /* Heart Control WatchKit Extension.appex in Embed App Extensions */,
);
name = "Embed App Extensions";
runOnlyForDeploymentPostprocessing = 0;
};
BE25B01D1D4F33B100DAF094 /* Embed Watch Content */ = {
isa = PBXCopyFilesBuildPhase;
buildActionMask = 2147483647;
dstPath = "$(CONTENTS_FOLDER_PATH)/Watch";
dstSubfolderSpec = 16;
files = (
BE25AFFA1D4F33B100DAF094 /* Heart Control WatchKit App.app in Embed Watch Content */,
);
name = "Embed Watch Content";
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXCopyFilesBuildPhase section */
/* Begin PBXFileReference section */
BE25AFE71D4F33B100DAF094 /* Heart Control.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "Heart Control.app"; sourceTree = BUILT_PRODUCTS_DIR; };
BE25AFEA1D4F33B100DAF094 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; };
BE25AFEC1D4F33B100DAF094 /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = ""; };
BE25AFEF1D4F33B100DAF094 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; };
BE25AFF11D4F33B100DAF094 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; };
BE25AFF41D4F33B100DAF094 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; };
BE25AFF61D4F33B100DAF094 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; };
BE25AFF91D4F33B100DAF094 /* Heart Control WatchKit App.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "Heart Control WatchKit App.app"; sourceTree = BUILT_PRODUCTS_DIR; };
BE25AFFF1D4F33B100DAF094 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Interface.storyboard; sourceTree = ""; };
BE25B0011D4F33B100DAF094 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; };
BE25B0031D4F33B100DAF094 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; };
BE25B0081D4F33B100DAF094 /* Heart Control WatchKit Extension.appex */ = {isa = PBXFileReference; explicitFileType = "wrapper.app-extension"; includeInIndex = 0; path = "Heart Control WatchKit Extension.appex"; sourceTree = BUILT_PRODUCTS_DIR; };
BE25B00D1D4F33B100DAF094 /* InterfaceController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = InterfaceController.swift; sourceTree = ""; };
BE25B00F1D4F33B100DAF094 /* ExtensionDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ExtensionDelegate.swift; sourceTree = ""; };
BE25B0111D4F33B100DAF094 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; };
BE25B0131D4F33B100DAF094 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; };
BE3FDBDB1D576B8D009165A8 /* HeartRate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = HeartRate.swift; sourceTree = ""; };
BE496A1C1D4F467100C82C4F /* Heart Control WatchKit Extension.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.xml; path = "Heart Control WatchKit Extension.entitlements"; sourceTree = ""; };
BE496A1D1D4F467900C82C4F /* Heart Control.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.xml; path = "Heart Control.entitlements"; sourceTree = ""; };
BE496A221D4F4D9A00C82C4F /* WorkoutManager.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = WorkoutManager.swift; sourceTree = ""; };
BE5AEE161D4F7CED0027C49C /* HKUnit+BeatsPerMinute.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "HKUnit+BeatsPerMinute.swift"; sourceTree = ""; };
BE7070081D57A13D00E41B95 /* HealthKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = HealthKit.framework; path = System/Library/Frameworks/HealthKit.framework; sourceTree = SDKROOT; };
BE70700A1D57A14300E41B95 /* HealthKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = HealthKit.framework; path = Platforms/WatchOS.platform/Developer/SDKs/WatchOS3.0.sdk/System/Library/Frameworks/HealthKit.framework; sourceTree = DEVELOPER_DIR; };
BE70700C1D57A29500E41B95 /* AuthorizationManger.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AuthorizationManger.swift; sourceTree = ""; };
BEB5C5BA1D4F656D00BBF490 /* HeartRateManager.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = HeartRateManager.swift; sourceTree = ""; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
BE25AFE41D4F33B000DAF094 /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
BE7070091D57A13D00E41B95 /* HealthKit.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
BE25B0051D4F33B100DAF094 /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
BE70700B1D57A14300E41B95 /* HealthKit.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXFrameworksBuildPhase section */
/* Begin PBXGroup section */
BE25AFDE1D4F33B000DAF094 = {
isa = PBXGroup;
children = (
BE25AFE91D4F33B100DAF094 /* Heart Control */,
BE25AFFD1D4F33B100DAF094 /* Heart Control WatchKit App */,
BE25B00C1D4F33B100DAF094 /* Heart Control WatchKit Extension */,
BE25AFE81D4F33B100DAF094 /* Products */,
BE496A191D4F467100C82C4F /* Frameworks */,
);
sourceTree = "";
};
BE25AFE81D4F33B100DAF094 /* Products */ = {
isa = PBXGroup;
children = (
BE25AFE71D4F33B100DAF094 /* Heart Control.app */,
BE25AFF91D4F33B100DAF094 /* Heart Control WatchKit App.app */,
BE25B0081D4F33B100DAF094 /* Heart Control WatchKit Extension.appex */,
);
name = Products;
sourceTree = "";
};
BE25AFE91D4F33B100DAF094 /* Heart Control */ = {
isa = PBXGroup;
children = (
BE3FDBDE1D576BC1009165A8 /* Supporting Files */,
BE25AFEA1D4F33B100DAF094 /* AppDelegate.swift */,
BE25AFEC1D4F33B100DAF094 /* ViewController.swift */,
BE25AFEE1D4F33B100DAF094 /* Main.storyboard */,
BE25AFF31D4F33B100DAF094 /* LaunchScreen.storyboard */,
);
path = "Heart Control";
sourceTree = "";
};
BE25AFFD1D4F33B100DAF094 /* Heart Control WatchKit App */ = {
isa = PBXGroup;
children = (
BE3FDBDF1D578CFE009165A8 /* Supporting Files */,
BE25AFFE1D4F33B100DAF094 /* Interface.storyboard */,
);
path = "Heart Control WatchKit App";
sourceTree = "";
};
BE25B00C1D4F33B100DAF094 /* Heart Control WatchKit Extension */ = {
isa = PBXGroup;
children = (
BE3FDBDD1D576BB1009165A8 /* Supporting Files */,
BE25B00D1D4F33B100DAF094 /* InterfaceController.swift */,
BE25B00F1D4F33B100DAF094 /* ExtensionDelegate.swift */,
BE496A221D4F4D9A00C82C4F /* WorkoutManager.swift */,
BEB5C5BA1D4F656D00BBF490 /* HeartRateManager.swift */,
BE70700C1D57A29500E41B95 /* AuthorizationManger.swift */,
BE3FDBDB1D576B8D009165A8 /* HeartRate.swift */,
BE5AEE161D4F7CED0027C49C /* HKUnit+BeatsPerMinute.swift */,
);
path = "Heart Control WatchKit Extension";
sourceTree = "";
};
BE3FDBDD1D576BB1009165A8 /* Supporting Files */ = {
isa = PBXGroup;
children = (
BE496A1C1D4F467100C82C4F /* Heart Control WatchKit Extension.entitlements */,
BE25B0111D4F33B100DAF094 /* Assets.xcassets */,
BE25B0131D4F33B100DAF094 /* Info.plist */,
);
name = "Supporting Files";
sourceTree = "";
};
BE3FDBDE1D576BC1009165A8 /* Supporting Files */ = {
isa = PBXGroup;
children = (
BE496A1D1D4F467900C82C4F /* Heart Control.entitlements */,
BE25AFF11D4F33B100DAF094 /* Assets.xcassets */,
BE25AFF61D4F33B100DAF094 /* Info.plist */,
);
name = "Supporting Files";
sourceTree = "";
};
BE3FDBDF1D578CFE009165A8 /* Supporting Files */ = {
isa = PBXGroup;
children = (
BE25B0011D4F33B100DAF094 /* Assets.xcassets */,
BE25B0031D4F33B100DAF094 /* Info.plist */,
);
name = "Supporting Files";
sourceTree = "";
};
BE496A191D4F467100C82C4F /* Frameworks */ = {
isa = PBXGroup;
children = (
BE70700A1D57A14300E41B95 /* HealthKit.framework */,
BE7070081D57A13D00E41B95 /* HealthKit.framework */,
);
name = Frameworks;
sourceTree = "";
};
/* End PBXGroup section */
/* Begin PBXNativeTarget section */
BE25AFE61D4F33B000DAF094 /* Heart Control */ = {
isa = PBXNativeTarget;
buildConfigurationList = BE25B01E1D4F33B100DAF094 /* Build configuration list for PBXNativeTarget "Heart Control" */;
buildPhases = (
BE25AFE31D4F33B000DAF094 /* Sources */,
BE25AFE41D4F33B000DAF094 /* Frameworks */,
BE25AFE51D4F33B000DAF094 /* Resources */,
BE25B01D1D4F33B100DAF094 /* Embed Watch Content */,
);
buildRules = (
);
dependencies = (
BE25AFFC1D4F33B100DAF094 /* PBXTargetDependency */,
);
name = "Heart Control";
productName = "Heart Control";
productReference = BE25AFE71D4F33B100DAF094 /* Heart Control.app */;
productType = "com.apple.product-type.application";
};
BE25AFF81D4F33B100DAF094 /* Heart Control WatchKit App */ = {
isa = PBXNativeTarget;
buildConfigurationList = BE25B01A1D4F33B100DAF094 /* Build configuration list for PBXNativeTarget "Heart Control WatchKit App" */;
buildPhases = (
BE25AFF71D4F33B100DAF094 /* Resources */,
BE25B0191D4F33B100DAF094 /* Embed App Extensions */,
);
buildRules = (
);
dependencies = (
BE25B00B1D4F33B100DAF094 /* PBXTargetDependency */,
);
name = "Heart Control WatchKit App";
productName = "Heart Control WatchKit App";
productReference = BE25AFF91D4F33B100DAF094 /* Heart Control WatchKit App.app */;
productType = "com.apple.product-type.application.watchapp2";
};
BE25B0071D4F33B100DAF094 /* Heart Control WatchKit Extension */ = {
isa = PBXNativeTarget;
buildConfigurationList = BE25B0161D4F33B100DAF094 /* Build configuration list for PBXNativeTarget "Heart Control WatchKit Extension" */;
buildPhases = (
BE25B0041D4F33B100DAF094 /* Sources */,
BE25B0051D4F33B100DAF094 /* Frameworks */,
BE25B0061D4F33B100DAF094 /* Resources */,
);
buildRules = (
);
dependencies = (
);
name = "Heart Control WatchKit Extension";
productName = "Heart Control WatchKit Extension";
productReference = BE25B0081D4F33B100DAF094 /* Heart Control WatchKit Extension.appex */;
productType = "com.apple.product-type.watchkit2-extension";
};
/* End PBXNativeTarget section */
/* Begin PBXProject section */
BE25AFDF1D4F33B000DAF094 /* Project object */ = {
isa = PBXProject;
attributes = {
LastSwiftUpdateCheck = 0800;
LastUpgradeCheck = 0800;
ORGANIZATIONNAME = "Thomas Paul Mann";
TargetAttributes = {
BE25AFE61D4F33B000DAF094 = {
CreatedOnToolsVersion = 8.0;
DevelopmentTeam = E6HN743D3A;
DevelopmentTeamName = "Thomas Mann";
ProvisioningStyle = Automatic;
SystemCapabilities = {
com.apple.HealthKit = {
enabled = 1;
};
};
};
BE25AFF81D4F33B100DAF094 = {
CreatedOnToolsVersion = 8.0;
DevelopmentTeam = E6HN743D3A;
DevelopmentTeamName = "Thomas Mann";
ProvisioningStyle = Automatic;
};
BE25B0071D4F33B100DAF094 = {
CreatedOnToolsVersion = 8.0;
DevelopmentTeam = E6HN743D3A;
DevelopmentTeamName = "Thomas Mann";
ProvisioningStyle = Automatic;
SystemCapabilities = {
com.apple.HealthKit = {
enabled = 1;
};
com.apple.HealthKit.watchos = {
enabled = 1;
};
};
};
};
};
buildConfigurationList = BE25AFE21D4F33B000DAF094 /* Build configuration list for PBXProject "Heart Control" */;
compatibilityVersion = "Xcode 3.2";
developmentRegion = English;
hasScannedForEncodings = 0;
knownRegions = (
en,
Base,
);
mainGroup = BE25AFDE1D4F33B000DAF094;
productRefGroup = BE25AFE81D4F33B100DAF094 /* Products */;
projectDirPath = "";
projectRoot = "";
targets = (
BE25AFE61D4F33B000DAF094 /* Heart Control */,
BE25AFF81D4F33B100DAF094 /* Heart Control WatchKit App */,
BE25B0071D4F33B100DAF094 /* Heart Control WatchKit Extension */,
);
};
/* End PBXProject section */
/* Begin PBXResourcesBuildPhase section */
BE25AFE51D4F33B000DAF094 /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
BE25AFF51D4F33B100DAF094 /* LaunchScreen.storyboard in Resources */,
BE25AFF21D4F33B100DAF094 /* Assets.xcassets in Resources */,
BE25AFF01D4F33B100DAF094 /* Main.storyboard in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
BE25AFF71D4F33B100DAF094 /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
BE25B0021D4F33B100DAF094 /* Assets.xcassets in Resources */,
BE25B0001D4F33B100DAF094 /* Interface.storyboard in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
BE25B0061D4F33B100DAF094 /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
BE25B0121D4F33B100DAF094 /* Assets.xcassets in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXResourcesBuildPhase section */
/* Begin PBXSourcesBuildPhase section */
BE25AFE31D4F33B000DAF094 /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
BE25AFED1D4F33B100DAF094 /* ViewController.swift in Sources */,
BE25AFEB1D4F33B100DAF094 /* AppDelegate.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
BE25B0041D4F33B100DAF094 /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
BE25B0101D4F33B100DAF094 /* ExtensionDelegate.swift in Sources */,
BE496A231D4F4D9A00C82C4F /* WorkoutManager.swift in Sources */,
BE5AEE171D4F7CED0027C49C /* HKUnit+BeatsPerMinute.swift in Sources */,
BE25B00E1D4F33B100DAF094 /* InterfaceController.swift in Sources */,
BE3FDBDC1D576B8D009165A8 /* HeartRate.swift in Sources */,
BE70700D1D57A29500E41B95 /* AuthorizationManger.swift in Sources */,
BEB5C5BB1D4F656D00BBF490 /* HeartRateManager.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXSourcesBuildPhase section */
/* Begin PBXTargetDependency section */
BE25AFFC1D4F33B100DAF094 /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
target = BE25AFF81D4F33B100DAF094 /* Heart Control WatchKit App */;
targetProxy = BE25AFFB1D4F33B100DAF094 /* PBXContainerItemProxy */;
};
BE25B00B1D4F33B100DAF094 /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
target = BE25B0071D4F33B100DAF094 /* Heart Control WatchKit Extension */;
targetProxy = BE25B00A1D4F33B100DAF094 /* PBXContainerItemProxy */;
};
/* End PBXTargetDependency section */
/* Begin PBXVariantGroup section */
BE25AFEE1D4F33B100DAF094 /* Main.storyboard */ = {
isa = PBXVariantGroup;
children = (
BE25AFEF1D4F33B100DAF094 /* Base */,
);
name = Main.storyboard;
sourceTree = "";
};
BE25AFF31D4F33B100DAF094 /* LaunchScreen.storyboard */ = {
isa = PBXVariantGroup;
children = (
BE25AFF41D4F33B100DAF094 /* Base */,
);
name = LaunchScreen.storyboard;
sourceTree = "";
};
BE25AFFE1D4F33B100DAF094 /* Interface.storyboard */ = {
isa = PBXVariantGroup;
children = (
BE25AFFF1D4F33B100DAF094 /* Base */,
);
name = Interface.storyboard;
sourceTree = "";
};
/* End PBXVariantGroup section */
/* Begin XCBuildConfiguration section */
BE25B0141D4F33B100DAF094 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_NONNULL = YES;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
COPY_PHASE_STRIP = NO;
DEBUG_INFORMATION_FORMAT = dwarf;
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_TESTABILITY = YES;
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_DYNAMIC_NO_PIC = NO;
GCC_NO_COMMON_BLOCKS = YES;
GCC_OPTIMIZATION_LEVEL = 0;
GCC_PREPROCESSOR_DEFINITIONS = (
"DEBUG=1",
"$(inherited)",
);
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
GCC_WARN_UNDECLARED_SELECTOR = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
};
name = Debug;
};
BE25B0151D4F33B100DAF094 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_NONNULL = YES;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
COPY_PHASE_STRIP = NO;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
ENABLE_NS_ASSERTIONS = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES;
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_NO_COMMON_BLOCKS = YES;
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
GCC_WARN_UNDECLARED_SELECTOR = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
VALIDATE_PRODUCT = YES;
};
name = Release;
};
BE25B0171D4F33B100DAF094 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ASSETCATALOG_COMPILER_COMPLICATION_NAME = Complication;
CODE_SIGN_ENTITLEMENTS = "Heart Control WatchKit Extension/Heart Control WatchKit Extension.entitlements";
INFOPLIST_FILE = "Heart Control WatchKit Extension/Info.plist";
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @executable_path/../../Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = "com.thomaspaulmann.Heart-Control.watchkitapp.watchkitextension";
PRODUCT_NAME = "${TARGET_NAME}";
SDKROOT = watchos;
SKIP_INSTALL = YES;
SWIFT_VERSION = 3.0;
TARGETED_DEVICE_FAMILY = 4;
WATCHOS_DEPLOYMENT_TARGET = 3.0;
};
name = Debug;
};
BE25B0181D4F33B100DAF094 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ASSETCATALOG_COMPILER_COMPLICATION_NAME = Complication;
CODE_SIGN_ENTITLEMENTS = "Heart Control WatchKit Extension/Heart Control WatchKit Extension.entitlements";
INFOPLIST_FILE = "Heart Control WatchKit Extension/Info.plist";
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @executable_path/../../Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = "com.thomaspaulmann.Heart-Control.watchkitapp.watchkitextension";
PRODUCT_NAME = "${TARGET_NAME}";
SDKROOT = watchos;
SKIP_INSTALL = YES;
SWIFT_VERSION = 3.0;
TARGETED_DEVICE_FAMILY = 4;
WATCHOS_DEPLOYMENT_TARGET = 3.0;
};
name = Release;
};
BE25B01B1D4F33B100DAF094 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
IBSC_MODULE = Heart_Control_WatchKit_Extension;
INFOPLIST_FILE = "Heart Control WatchKit App/Info.plist";
PRODUCT_BUNDLE_IDENTIFIER = "com.thomaspaulmann.Heart-Control.watchkitapp";
PRODUCT_NAME = "$(TARGET_NAME)";
SDKROOT = watchos;
SKIP_INSTALL = YES;
SWIFT_VERSION = 3.0;
TARGETED_DEVICE_FAMILY = 4;
WATCHOS_DEPLOYMENT_TARGET = 3.0;
};
name = Debug;
};
BE25B01C1D4F33B100DAF094 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
IBSC_MODULE = Heart_Control_WatchKit_Extension;
INFOPLIST_FILE = "Heart Control WatchKit App/Info.plist";
PRODUCT_BUNDLE_IDENTIFIER = "com.thomaspaulmann.Heart-Control.watchkitapp";
PRODUCT_NAME = "$(TARGET_NAME)";
SDKROOT = watchos;
SKIP_INSTALL = YES;
SWIFT_VERSION = 3.0;
TARGETED_DEVICE_FAMILY = 4;
WATCHOS_DEPLOYMENT_TARGET = 3.0;
};
name = Release;
};
BE25B01F1D4F33B100DAF094 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CODE_SIGN_ENTITLEMENTS = "Heart Control/Heart Control.entitlements";
INFOPLIST_FILE = "Heart Control/Info.plist";
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = "com.thomaspaulmann.Heart-Control";
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 3.0;
};
name = Debug;
};
BE25B0201D4F33B100DAF094 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CODE_SIGN_ENTITLEMENTS = "Heart Control/Heart Control.entitlements";
INFOPLIST_FILE = "Heart Control/Info.plist";
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = "com.thomaspaulmann.Heart-Control";
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 3.0;
};
name = Release;
};
/* End XCBuildConfiguration section */
/* Begin XCConfigurationList section */
BE25AFE21D4F33B000DAF094 /* Build configuration list for PBXProject "Heart Control" */ = {
isa = XCConfigurationList;
buildConfigurations = (
BE25B0141D4F33B100DAF094 /* Debug */,
BE25B0151D4F33B100DAF094 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
BE25B0161D4F33B100DAF094 /* Build configuration list for PBXNativeTarget "Heart Control WatchKit Extension" */ = {
isa = XCConfigurationList;
buildConfigurations = (
BE25B0171D4F33B100DAF094 /* Debug */,
BE25B0181D4F33B100DAF094 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
BE25B01A1D4F33B100DAF094 /* Build configuration list for PBXNativeTarget "Heart Control WatchKit App" */ = {
isa = XCConfigurationList;
buildConfigurations = (
BE25B01B1D4F33B100DAF094 /* Debug */,
BE25B01C1D4F33B100DAF094 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
BE25B01E1D4F33B100DAF094 /* Build configuration list for PBXNativeTarget "Heart Control" */ = {
isa = XCConfigurationList;
buildConfigurations = (
BE25B01F1D4F33B100DAF094 /* Debug */,
BE25B0201D4F33B100DAF094 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
/* End XCConfigurationList section */
};
rootObject = BE25AFDF1D4F33B000DAF094 /* Project object */;
}
================================================
FILE: Heart Control.xcodeproj/project.xcworkspace/contents.xcworkspacedata
================================================
================================================
FILE: README.md
================================================
[](https://swift.org) [](https://developer.apple.com/watchos/)
# Heart Control
Monitor your heart rate on the apple watch - continuously and easy.
## What is it?
Heart Control is a standalone watch app to monitor continuously heart rate on [watchOS 3](http://www.apple.com/watchos-preview/). It collects and analyzes data in real-time in the background.
## What is it not?
It's not a whole implementation of every little detail of [Apple's HealthKit](https://developer.apple.com/healthkit/). It's more or less a quick start guide for workout apps on watchOS 3.
## Special Thanks
Thanks to [Dash Brittain](http://www.roxannebrittain.com) and [Jorge Morinigo](https://www.linkedin.com/in/jorgemorinigo) for your WWDC talk [Building Great Workout Apps](https://developer.apple.com/videos/play/wwdc2016/235/).