GRPCMessage

public protocol GRPCMessage : Message

GRPCMessage is a protocol that is implemented by gRPC protocol buffer message structures that are generated by the code generator.

Every implementation is associated with a GRPCModel which can be used to instantiate a GRPCMessage that also offers a method that convertd the message to a model type. Implementations of this protocol also need to conform to the Message protocol provided by the SwiftProtobuf framework which includes all the necessary requirements to encode a GRPCMessage as a protocol buffer message.

  • Every GRPCMessage is associated to a GRPCModel from the existing code.

    Declaration

    Swift

    associatedtype ModelType : GRPCModel
  • Initializes a GRPCMessage using an instance of the associated type. This initializer initializes the message’s attributes by mapping the model objects attributes. Its implementation is usually generated by the code generator.

    Declaration

    Swift

    init(modelObject: ModelType)

    Parameters

    modelObject

    ModelType instance that provides the values for the message’s attributes.

  • Creates and returns an instance of the associated GRPCModel with the messages attribute values mapped to the model instance.

    This method will instantiate the associated GRPCModel using its empty initializer and map the message’s attribute to the attributes of the model instance. Its implementation is usually generated by the code generator.

    Declaration

    Swift

    func toModel() -> ModelType

    Return Value

    An instance of the associated GRPCModel