NACCWatchAppContentViewWatchDelegate
class NACCWatchAppContentViewWatchDelegate : NSObject, WCSessionDelegate
This class exists to give the Watch Connectivity a place to work.
-
This is a template for the update callback.
Declaration
Swift
typealias ApplicationContextHandler = (_ inApplicationContext: [String : Any]) -> Void
Parameters
inApplicationContext
The new application context.
-
Just here to satisfy the protocol.
-
Just here to satisfy the protocol.
-
This will be called when the context changes. This is always called in the main thread.
Declaration
Swift
var updateHandler: ApplicationContextHandler?
-
This maintains a reference to the session.
Declaration
Swift
var wcSession: WCSession
-
This is a simple semaphore, to indicate that an update to/from the peer is in progress.
Declaration
Swift
var isUpdateInProgress: Bool
-
Called when an activation change occurs.
Declaration
Swift
func session(_ inSession: WCSession, activationDidCompleteWith inActivationState: WCSessionActivationState, error inError: (any Error)?)
Parameters
inSession
The session experiencing the activation change.
activationDidCompleteWith
The new state.
error
If there was an error, it is sent in here.
-
Called when the application context is updated from the peer.
Declaration
Swift
func session(_ inSession: WCSession, didReceiveApplicationContext inApplicationContext: [String : Any])
Parameters
inSession
The session receiving the context update.
didReceiveApplicationContext
The new context data.
-
-
Declaration
Swift
func sendContextRequest()
-
This is called to send the current state of the prefs to the peer.
Declaration
Swift
func sendApplicationContext()
-
Initializer
Declaration
Swift
init(updateHandler inUpdateHandler: ApplicationContextHandler?)
Parameters
updateHandler
The function that will be called with any updates.