MapsIndoors iOS SDK  V3
Instance Methods | List of all members
<AbstractMPJSONModelProtocol> Protocol Reference

#import <MPJSONModel.h>

Inheritance diagram for <AbstractMPJSONModelProtocol>:
MPJSONModel MPAppData MPBuilding MPBuildingDataset MPFloor MPGeometry MPLocation MPLocationDataset MPLocationDisplayRule MPMapStyle MPMessageDataset MPPositionResult MPRoute MPRouteBounds MPRouteCoordinate MPRouteLeg MPRouteProperty MPRouteResult MPRouteStep MPSolution MPTransitAgency MPTransitDetails MPTransitLine MPTransitStop MPTransitTime MPTransitVehicle MPType MPVenue MPVenueCollection

Instance Methods

(instancetype) - initWithDictionary:error:
 
(instancetype) - initWithData:error:
 
(NSDictionary *) - toDictionary
 
(NSDictionary *) - toDictionaryWithKeys:
 

Detailed Description

A protocol describing an abstract MPJSONModel class MPJSONModel conforms to this protocol, so it can use itself abstractly

Method Documentation

◆ initWithData:error:

- (instancetype) initWithData: (NSData *)  data
error: (NSError **)  error 
required

All MPJSONModel classes should implement initWithData:error:

For most classes the default initWithData: inherited from MPJSONModel itself should suffice, but developers have the option to also overwrite it if needed.

Parameters
datarepresenting a JSON response (usually fetched from web), to be imported in the model.
erroran error or NULL

◆ initWithDictionary:error:

- (instancetype) initWithDictionary: (NSDictionary *)  dict
error: (NSError **)  err 
required

All MPJSONModel classes should implement initWithDictionary:

For most classes the default initWithDictionary: inherited from MPJSONModel itself should suffice, but developers have the option to also overwrite it if needed.

Parameters
dicta dictionary holding JSON objects, to be imported in the model.
erran error or NULL

◆ toDictionary

- (NSDictionary *) toDictionary
required

All MPJSONModel classes should be able to export themselves as a dictionary of JSON compliant objects.

For most classes the inherited from MPJSONModel default toDictionary implementation should suffice.

Returns
NSDictionary dictionary of JSON compliant objects
Exceptions
MPJSONModelTypeNotAllowedExceptionthrown when one of your model's custom class properties does not have matching transformer method in an MPJSONValueTransformer.

◆ toDictionaryWithKeys:

- (NSDictionary *) toDictionaryWithKeys: (NSArray< NSString * > *)  propertyNames
required

Export a model class to a dictionary, including only given properties

Parameters
propertyNamesthe properties to export; if nil, all properties exported
Returns
NSDictionary dictionary of JSON compliant objects
Exceptions
MPJSONModelTypeNotAllowedExceptionthrown when one of your model's custom class properties does not have matching transformer method in an MPJSONValueTransformer.

The documentation for this protocol was generated from the following file: