Last active
August 29, 2015 14:21
-
-
Save billglover/81477e0fb4bc43069f70 to your computer and use it in GitHub Desktop.
Using openParentApplication:reply: to pass UIColor
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
import WatchKit | |
import Foundation | |
class InterfaceController: WKInterfaceController { | |
@IBAction func ButtonPress() { | |
var userInfo: [NSObject: AnyObject] = [:] | |
userInfo["request"] = "This is a string" | |
// send a request String to the parent application | |
// expect a response UIColor in return | |
WKInterfaceController.openParentApplication(userInfo, reply: {(reply, error) -> Void in | |
if let response: UIColor = reply?["response"] as? UIColor { | |
println("response: \(response)") | |
} else { | |
println("response received but not recognised") | |
} | |
}) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment