April 2020
Beginner
316 pages
8h 20m
English
First, let's start by heading on over to HostingController.swift and conforming our class to WCSessionDelegate.
Before we do anything, we'll need to import the WatchConnectivity framework:
import WatchConnectivity
Now, we can add the WCSessionDelegate protocol to our class:
class HostingController: WKHostingController<HomeView>, WCSessionDelegate { // Remaining code here...}
This will force us to add the following delegate methods into our class:
func session(_ session: WCSession, activationDidCompleteWith activationState: WCSessionActivationState, error: Error?) { }
We can leave activationDidCompleteWith activationState empty as we won't be needing this for our app. Although, if you wanted to add any error handling, ...
Read now
Unlock full access