PureMessageHandler
public class PureMessageHandler : MessageParser
A utility to parse RawMessages and call their attached handlers.
Handlers are functions that will be executed when handle(rawMessage: RawMessage) is called. Handlers are attached to a specific Message type for example: ProgramBusChanged.
-
Attaches a message handler to a concrete
Messagetype. Every time a message of this type comes in, the providedhandlerwill be called. The handler takes one generic argumentmessage. The type of this argument indicates the type that this message handler will be attached to.Declaration
Swift
public func when<M>(_ handler: @escaping (_ message: M) -> Void) where M : DeserializableMessageParameters
handlerThe handler to attach
messageThe message to which the handler is attached
View on GitHub
PureMessageHandler Class Reference