Last active
August 29, 2015 14:20
-
-
Save julianjames/85f37ed7ab492fc5a862 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// GlanceController.swift | |
// Hackaball WatchKit Extension | |
// | |
// Created by Julian James on 29/04/2015. | |
// Copyright (c) 2015 Made by Many. All rights reserved. | |
// | |
import WatchKit | |
import Foundation | |
class GlanceController: WKInterfaceController { | |
@IBOutlet var connectionLabel : WKInterfaceLabel! | |
override func awakeWithContext(context: AnyObject?) { | |
super.awakeWithContext(context) | |
// Configure interface objects here. | |
let parentValues = [ "Watch" : "" ] | |
WKInterfaceController.openParentApplication(parentValues, reply: { (replyValues, error) -> Void in | |
println(replyValues["Ball State"]) | |
var state = replyValues["Ball State"] as! String | |
if state == "Connected!" | |
{ | |
self.connectionLabel.setTextColor(UIColor.greenColor()) | |
} | |
else | |
{ | |
self.connectionLabel.setTextColor(UIColor.redColor()) | |
} | |
self.connectionLabel.setText((state)) | |
}) | |
} | |
override func willActivate() { | |
// This method is called when watch view controller is about to be visible to user | |
super.willActivate() | |
} | |
override func didDeactivate() { | |
// This method is called when watch view controller is no longer visible | |
super.didDeactivate() | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment