NSDictionary(SFAdditions) Category Reference

Declared in NSDictionary+SFAdditions.h

Overview

Extension to NSDictionary object

Support retrieval of value use “/” separated hiearchy key

– sfsdk_objectAtPath:

Get object from NSDictionary with “/” separated path.

- (nullable id)sfsdk_objectAtPath:(nullable NSString *)path

Parameters

path

Path for the object to retrieve. Use “/” to separate between levels. For example, root/child/valueKey will retrieve value from the root NSDictionary object to its child dictionary’s value with key “valueKey”

Discussion

This method is similar to the built-in valueForKeyPath function except it handles special value like NSNULL and in the NSDictonary element value*

Declared In

NSDictionary+SFAdditions.h

– objectAtPath:

- (nullable id)objectAtPath:(nullable NSString *)path

– sfsdk_nonNullObjectForKey:

Returns an object whose ID is key, or nil.

- (nullable id)sfsdk_nonNullObjectForKey:(nullable id)key

Parameters

key

The ID of an object, or a null value

Return Value

An object whose ID is key, or else nil if the key has a value of NSNull or an NSString value of “” or “”.

Declared In

NSDictionary+SFAdditions.h

– nonNullObjectForKey:

- (nullable id)nonNullObjectForKey:(nullable id)key

– sfsdk_jsonString

Returns the dictionary’s contents reformatted as a JSON string.

- (nullable NSString *)sfsdk_jsonString

Declared In

NSDictionary+SFAdditions.h

– jsonString

- (nullable NSString *)jsonString