FMutableData Class Reference

Inherits from NSObject
Declared in FMutableData.h

Overview

An FMutableData instance is populated with data from a Firebase location. When you are using runTransactionBlock:, you will be given an instance containing the current data at that location. Your block will be responsible for updating that instance to the data you wish to save at that location, and then returning using [FTransactionResult successWithValue:].

To modify the data, set its value property to any of the native types support by Firebase: * NSNumber (includes BOOL) * NSDictionary * NSArray * NSString * nil / NSNull to remove the data

Note that changes made to a child FMutableData instance will be visible to the parent.

Inspecting and navigating the data

– hasChildren

Returns boolean indicating whether this mutable data has children.

- (BOOL)hasChildren

Return Value

YES if this data contains child nodes.

Discussion

Returns boolean indicating whether this mutable data has children.

Declared In

FMutableData.h

– hasChildAtPath:

Indicates whether this mutable data has a child at the given path.

- (BOOL)hasChildAtPath:(NSString *)path

Parameters

path

A path string, consisting either of a single segment, like ‘child’, or multiple segments, ‘a/deeper/child’

Return Value

YES if this data contains a child at the specified relative path

Discussion

Indicates whether this mutable data has a child at the given path.

Declared In

FMutableData.h

– childDataByAppendingPath:

Used to obtain an FMutableData instance that encapsulates the data at the given relative path. Note that changes made to the child will be visible to the parent.

- (FMutableData *)childDataByAppendingPath:(NSString *)path

Parameters

path

A path string, consisting either of a single segment, like ‘child’, or multiple segments, ‘a/deeper/child’

Return Value

An FMutableData instance containing the data at the given path

Discussion

Used to obtain an FMutableData instance that encapsulates the data at the given relative path. Note that changes made to the child will be visible to the parent.

Declared In

FMutableData.h

Properties

  parent

This method is deprecated.

@property (strong, readonly, nonatomic) FMutableData *parent

Return Value

An FMutableData instance containing the data at the parent location, or nil if this is the top-most location

Discussion

This method is deprecated.

Declared In

FMutableData.h

  value

To modify the data contained by this instance of FMutableData, set this to any of the native types support by Firebase: * NSNumber (includes BOOL) * NSDictionary * NSArray * NSString * nil / NSNull to remove the data

@property (strong, nonatomic) id value

Return Value

The current data at this location as a native object

Discussion

To modify the data contained by this instance of FMutableData, set this to any of the native types support by Firebase: * NSNumber (includes BOOL) * NSDictionary * NSArray * NSString * nil / NSNull to remove the data

Note that setting the value will override the priority at this location.

Declared In

FMutableData.h

  priority

Set this property to update the priority of the data at this location. Can be set to the following types: * NSNumber * NSString * nil / NSNull to remove the priority

@property (strong, nonatomic) id priority

Return Value

The priority of the data at this location

Discussion

Set this property to update the priority of the data at this location. Can be set to the following types: * NSNumber * NSString * nil / NSNull to remove the priority

Declared In

FMutableData.h

  childrenCount

The number of child nodes at this location

@property (readonly, nonatomic) NSUInteger childrenCount

Return Value

The number of child nodes at this location

Declared In

FMutableData.h

  children

Used to iterate over the children at this location. You can use the native for .. in syntax:

@property (readonly, nonatomic, strong) NSEnumerator *children

Discussion

Used to iterate over the children at this location. You can use the native for .. in syntax:

for (FMutableData* child in data.children) { … }

Note that this enumerator operates on an immutable copy of the child list. So, you can modify the instance during iteration, but the new additions will not be visible until you get a new enumerator.

Declared In

FMutableData.h

  key

The key name of this node, or nil if it is the top-most location

@property (readonly, nonatomic, strong) NSString *key

Return Value

The key name of this node, or nil if it is the top-most location

Declared In

FMutableData.h