DBSerializable

Objective-C

@protocol DBSerializable <NSObject>

Swift

protocol DBSerializable : NSObjectProtocol

Protocol which all Obj-C SDK API route objects must implement, otherwise a compiler-warning is generated.

  • Class method which returns a json-compatible dictionary representation of the supplied object.

    Declaration

    Objective-C

    + (nullable NSDictionary<NSString *, id> *)serialize:(nonnull id)instance;

    Swift

    static func serialize(_ instance: Any) -> [String : Any]?

    Parameters

    instance

    An instance of the API object to be serialized.

    Return Value

    A serialized, json-compatible dictionary representation of the API object.

  • Class method which returns an instantiation of the supplied object as represented by a json-compatible dictionary.

    Declaration

    Objective-C

    + (nonnull id)deserialize:(nonnull NSDictionary<NSString *, id> *)dict;

    Swift

    static func deserialize(_ dict: [String : Any]) -> Any

    Parameters

    dict

    A dictionary representation of the API object to be serialized.

    Return Value

    A deserialized, instantiation of the API object.

  • Description method.

    Declaration

    Objective-C

    - (nonnull NSString *)description;

    Swift

    func description() -> String

    Return Value

    A human-readable representation of the current object.