Inherits from NSObject
Declared in RKMappingResult.h

Overview

The RKMappingResult class represents the aggregate object mapping results returned by an RKMapperOperation object. The mapping result provides a thin interface on top of an NSDictionary and provides convenient interfaces for accessing the mapping results in various representations.

Tasks

Creating a Mapping Result

Retrieving Result Representations

  • – dictionary

    Returns a representation of the mapping result as a dictionary.

  •   firstObject

    Returns a representation of the mapping result as a single object by returning the first mapped value from the aggregate array of mapped objects.

    property
  • – array

    Returns a representation of the mapping result as an array of objects.

  •   set

    Returns a representation of the mapping result as a set of objects.

    property

Counting Entries

  •   count

    Returns a count of the number of objects contained in the mapping result. This is an aggregate count of all objects across all mapped key paths in the result.

    property

Properties

count

@property (nonatomic, readonly) NSUInteger count
Discussion

Returns a count of the number of objects contained in the mapping result. This is an aggregate count of all objects across all mapped key paths in the result.

Return Value

A count of the number of mapped objects in the mapping result.

Declared In

RKMappingResult.h

firstObject

@property (nonatomic, readonly, strong) id firstObject
Discussion

Returns a representation of the mapping result as a single object by returning the first mapped value from the aggregate array of mapped objects.

The mapping result is coerced into a single object by retrieving all mapped objects and returning the first object. If the mapping result is empty, nil is returned.

Return Value

The first object contained in the mapping result.

Declared In

RKMappingResult.h

set

@property (nonatomic, readonly, copy) NSSet *set
Discussion

Returns a representation of the mapping result as a set of objects.

The set returned is a flattened collection of all mapped object values contained in the underlying dictionary result representation.

Return Value

A set containing the objects contained in the mapping result.

Declared In

RKMappingResult.h

Instance Methods

array

- (NSArray *)array
Discussion

Returns a representation of the mapping result as an array of objects.

The array returned is a flattened collection of all mapped object values contained in the underlying dictionary result representation. No guarantee is made as to the ordering of objects within the returned collection when more than one key path was mapped, as NSDictionary objects are unordered,

Return Value

An array containing the objects contained in the mapping result.

Declared In

RKMappingResult.h

dictionary

- (NSDictionary *)dictionary
Discussion

Returns a representation of the mapping result as a dictionary.

The keys of the returned dictionary will correspond to the mapped key paths in the source object representation and the values will be the mapped objects. The returned value is a copy of the dictionary that was used to initialize the mapping result.

Return Value

A dictionary containing the mapping results.

Declared In

RKMappingResult.h

initWithDictionary:

- (instancetype)initWithDictionary:(NSDictionary *)dictionary
Discussion

Initializes the receiver with a dictionary of mapped key paths and object values.

Parameters

dictionary

A dictionary wherein the keys represent mapped key paths and the values represent the objects mapped at those key paths. Cannot be nil.

Return Value

The receiver, initialized with the given dictionary.

Declared In

RKMappingResult.h