Search code examples
swift2watchkitwatch

Calling a method in Watch ExtensionDelegate


How do you call a method in the Watch ExtensionDelegate from an interface controller?

For the life of me I cannot get it to work?

So, ExtensionDelegate.mymethod(string:param)

??


Solution

  • Here is how you get an instance of your watchkit delegate:

    let myDelegate = WKExtension.sharedExtension().delegate as! ExtensionDelegate
    

    You can call your methods on this object.