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]) -> VoidParameters
inApplicationContextThe new application context.
-
Just here to satisfy the protocol.
Declaration
Swift
func sessionDidBecomeInactive(_: WCSession) -
Just here to satisfy the protocol.
Declaration
Swift
func sessionDidDeactivate(_: WCSession) -
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
inSessionThe session experiencing the activation change.
activationDidCompleteWithThe new state.
errorIf 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
inSessionThe session receiving the context update.
didReceiveApplicationContextThe new context data.
-
Declaration
Swift
func session(_ inSession: WCSession, didReceiveMessage inMessage: [String : Any])Parameters
inSessionThe session receiving the message.
-
-
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
updateHandlerThe function that will be called with any updates.
View on GitHub