Skip to content

Commit

Permalink
d12 → Swift 1.2 (code)
Browse files Browse the repository at this point in the history
  • Loading branch information
Sam Davies committed Mar 3, 2015
1 parent 61f6f4f commit 53374de
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 10 deletions.
5 changes: 0 additions & 5 deletions 12-healthkit/BodyTemple/BodyTemple/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,5 @@ class AppDelegate: UIResponder, UIApplicationDelegate {

var window: UIWindow?

func application(application: UIApplication!, didFinishLaunchingWithOptions launchOptions: NSDictionary!) -> Bool {
// Override point for customization after application launch.
return true
}

}

6 changes: 3 additions & 3 deletions 12-healthkit/BodyTemple/BodyTemple/TabBarViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class TabBarViewController: UITabBarController {
self.healthStore = HKHealthStore()
}

for vc in viewControllers as [UIViewController] {
for vc in viewControllers as! [UIViewController] {
if let healthStoreUser = vc as? HealthStoreUser {
healthStoreUser.healthStore = self.healthStore
}
Expand All @@ -60,8 +60,8 @@ class TabBarViewController: UITabBarController {
HKCharacteristicType.characteristicTypeForIdentifier(HKCharacteristicTypeIdentifierDateOfBirth)
]

self.healthStore?.requestAuthorizationToShareTypes(NSSet(array: dataTypesToWrite),
readTypes: NSSet(array: dataTypesToRead), completion: {
self.healthStore?.requestAuthorizationToShareTypes(Set<NSObject>(arrayLiteral: dataTypesToWrite),
readTypes: Set<NSObject>(arrayLiteral: dataTypesToRead), completion: {
(success, error) in
if success {
println("User completed authorisation request.")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ class WeightTableViewController: UITableViewController, WeightEntryDelegate, Hea
}

override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCellWithIdentifier("WeightCell", forIndexPath: indexPath) as UITableViewCell
let cell = tableView.dequeueReusableCellWithIdentifier("WeightCell", forIndexPath: indexPath) as! UITableViewCell
// Configure the cell...
let sample = weightSamples[indexPath.row]
let weight = sample.quantity.doubleValueForUnit(HKUnit(fromString: "kg"))
Expand Down Expand Up @@ -95,7 +95,7 @@ class WeightTableViewController: UITableViewController, WeightEntryDelegate, Hea
}

dispatch_async(dispatch_get_main_queue()) {
self.weightSamples = results as [HKQuantitySample]
self.weightSamples = results as! [HKQuantitySample]
self.tableView.reloadData()
}

Expand Down

0 comments on commit 53374de

Please sign in to comment.