LHDataObject

@interface LHDataObject : NSObject

LIVEhouse.in data model base class

  • Create an array with LHDataObject or subclass object inside

    Declaration

    Objective-C

    + (nonnull NSArray *)objectsWithArrayOfJSON:(nonnull NSArray *)jsonArray;

    Swift

    class func objects(withArrayOfJSON jsonArray: [Any]) -> [Any]

    Parameters

    jsonArray

    JSON data to mapping

    Return Value

    a desired NSArray object

  • designated initializer to mapping raw JSON data to an object

    subclass of LHDataObject can override this method to provide it own implementation

    Declaration

    Objective-C

    - (nullable instancetype)initWithJSON:(nonnull NSDictionary *)json;

    Swift

    init?(json: [AnyHashable : Any])

    Parameters

    json

    a dictionary of raw JSON data

    Return Value

    an LHDataObject instance if mapping success, nil when mapping failure