MLSubclassing Protocol Reference

Conforms to NSObject
Declared in MLSubclassing.h

Overview

If a subclass of MLObject conforms to MLSubclassing and calls registerSubclass, MaxLeap will be able to use that class as the native class for a MaxLeap object.

Classes conforming to this protocol should subclass MLObject and include MLObject+Subclass.h in their implementation file. This ensures the methods in the Subclass category of MLObject are exposed in its subclasses only.

+ object required method

Constructs an object of the most specific class known to implement +leapClassName. This method takes care to help MLObject subclasses be subclassed themselves. For example, [MLUser object] returns a MLUser by default but will return an object of a registered subclass instead if one is known. A default implementation is provided by MLObject which should always be sufficient.

+ (instancetype)object

Return Value

Returns the object that is instantiated.

Declared In

MLSubclassing.h

+ objectWithoutDataWithObjectId: required method

Creates a reference to an existing MLObject for use in creating associations between MLObjects. Calling isDataAvailable on this object will return NO until fetchIfNeeded or refresh has been called. No network request will be made. A default implementation is provided by MLObject which should always be sufficient.

+ (instancetype)objectWithoutDataWithObjectId:(nullable NSString *)objectId

Parameters

objectId

The object id for the referenced object.

Return Value

A MLObject without data.

Declared In

MLSubclassing.h

+ leapClassName required method

The name of the class as seen in the REST API.

+ (NSString *)leapClassName

Declared In

MLSubclassing.h

+ query required method

Create a query which returns objects of this type.
A default implementation is provided by MLObject which should always be sufficient.

+ (MLQuery *)query

Declared In

MLSubclassing.h

+ registerSubclass required method

Lets MaxLeap know this class should be used to instantiate all objects with class type leapClassName.
This method must be called before [MaxLeap setApplicationId:clientKey:site:]

+ (void)registerSubclass

Declared In

MLSubclassing.h