Search code examples
ioswatchkitphone-callwatchos-2watchos

Phone call from Apple Watch with openSystem API?


As I watched the WWDC 2015 session video "Introducing WatchKit for watchOS 2" (at 13:29), I saw that it is possible to make phone calls directly on Apple Watch with the openSystem API. How can I use this API in Swift?


Solution

  • You can use the openSystemURL method, which is available on the shared WKExtension object. Pass a tel: URL to this method to initiate a phone call.

    if let telURL=NSURL(string:"tel:5553478") {
        let wkExtension=WKExtension.sharedExtension()
        wkExtension.openSystemURL(telURL)
    }