iOS HMLocalDeviceDelegate

HMLocalDeviceDelegate is used to dispatch HMLocalDevice's events. All invocations are executed on the main thread.

Methods

State changed to a new one

Declaration

func localDevice(stateChanged newState: HMLocalDeviceState, oldState: HMLocalDeviceState)

Parameters

newState

(HMLocalDeviceState) the new state

oldState

(HMLocalDeviceState) previous state

Read More

Example

import HMKit

extension SomeType: HMLocalDeviceDelegate {

    /*
    Other required methods implementation
    */

    func localDevice(stateChanged newState: HMLocalDeviceState, oldState: HMLocalDeviceState) {
        switch (newState, oldState) {
        case (.broadcasting, _):
            print("Device started broadcasting.")

        case (.idle, .broadcasting):
            print("Device stopped broadcasting.")

        default:
            break
        }
    }
}