How to check whether iPhone and apple watch are connected

Mohit Totlani picture Mohit Totlani · Jan 6, 2015 · Viewed 18.2k times · Source

Is there any way to notify user in Apple Watch that the iPhone is now out of range and when it comes back in range. How can we do it in watch extension.

Thanks in advance.

Answer

BilalReffas picture BilalReffas · Jun 11, 2015

So on WatchOS 2 that is possible !

You have to do on iPhone side :

First :

import WatchConnectivity

Then :

   if WCSession.isSupported() { // check if the device support to handle an Apple Watch
        let session = WCSession.defaultSession()
        session.delegate = self
        session.activateSession() // activate the session

        if session.paired { // Check if the iPhone is paired with the Apple Watch
                // Do stuff
        }
    }

I hope It would help you :)