BTNSerializable Protocol Reference

Conforms to NSObject
Declared in BTNSerializable.h

+ canInitWithDictionary: required method

Checks that a dictionary contains all keys required to instantiate a valid instance of the object using the initWithDictionary method

+ (BOOL)canInitWithDictionary:(nonnull NSDictionary *)dictionary

Parameters

dictionary

A dictionary of keys to be evaluated for use with initWithDictionary

Return Value

BOOL Whether this dictionary can create a valid instance of the object *

Discussion

Checks that a dictionary contains all keys required to instantiate a valid instance of the object using the initWithDictionary method

Declared In

BTNSerializable.h

– initWithDictionary: required method

Creates an instance of the object from a valid NSDictionary which provides at least all mandatory keys for the object as checked in canInitWithDictionary:

- (nullable instancetype)initWithDictionary:(nonnull NSDictionary *)dictionary

Parameters

dictionary

The dictionary of keys to create the object from

Return Value

instance of the object, or nil if all mandatory keys are not present *

Discussion

Creates an instance of the object from a valid NSDictionary which provides at least all mandatory keys for the object as checked in canInitWithDictionary:

Declared In

BTNSerializable.h

– updateWithRepresentation: required method

Updates an instance of the object from a valid NSDictionary which provides at least all mandatory keys for the object as checked in canInitWithDictionary:

- (void)updateWithRepresentation:(nonnull NSDictionary *)dictionary

Parameters

dictionary

The dictionary of keys to create the object from *

Discussion

Updates an instance of the object from a valid NSDictionary which provides at least all mandatory keys for the object as checked in canInitWithDictionary:

Declared In

BTNSerializable.h

– dictionaryRepresentation required method

Translates the object into a serializable dictionary of keys matching initWithDictionary

- (nullable NSDictionary *)dictionaryRepresentation

Return Value

NSDictionary A dictionary which can be used to recreate the object from initWithDictionary

Discussion

Translates the object into a serializable dictionary of keys matching initWithDictionary

Note: [[[instancetype alloc] initWithDictionary:[existingObject dictionaryRepresentation]] isEqual:existingObject] should always be true *

Declared In

BTNSerializable.h