SerializableObject

public protocol SerializableObject

Protocol encapsulating a set of methods and properties that are needed to serialized and deserialize an object to and from a byte array, e.g. Data.

  • Object version.

    Declaration

    Swift

    var version: Int { get }
  • Dictionary containing the list of properties associated with this object.

    Declaration

    Swift

    var properties: [String : Any] { get }
  • Serializes this object to a byte array.

    Throws

    SerializableObjectError.serializationError, SerializableObjectError.fatalError

    Declaration

    Swift

    func toData() throws -> Data

    Return Value

    Serialized object data.

  • Deserializes this object properties from a byte array.

    Throws

    SerializableObjectError.serializationError, SerializableObjectError.fatalError

    Declaration

    Swift

    func loadFromData(_ data: Data) throws

    Parameters

    data

    Serialized object data.