Skip to content

Instantly share code, notes, and snippets.

@Eluss
Last active October 2, 2015 15:57
Show Gist options
  • Save Eluss/2f0c64a042b9c3b2fd1a to your computer and use it in GitHub Desktop.
Save Eluss/2f0c64a042b9c3b2fd1a to your computer and use it in GitHub Desktop.
openParentApplication
@IBAction func buttonAction() {
let dictionary = ["message": "Hi, apple watch here!"]
WKInterfaceController.openParentApplication(dictionary) {
(replyInfo, error) -> Void in
let reply = replyInfo["event"] as! NSData // take our encoded event from dictionary
NSKeyedUnarchiver.setClass(Event.self, forClassName: "Event") // We are not using original class anymore, so we have to do it
let event = NSKeyedUnarchiver.unarchiveObjectWithData(reply) // decode the event
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment