LuxChat  2.0
Instant messenger for iOS
List of all members
FIRDataSnapshot Class Reference

#import <FIRDataSnapshot.h>

Inheritance diagram for FIRDataSnapshot:

Instance Methods

Navigating and inspecting a snapshot
(FIRDataSnapshot *) - childSnapshotForPath:
 
(BOOL) - hasChild:
 
(BOOL) - hasChildren
 
(BOOL) - exists
 
Data export
(id __nullable) - valueInExportFormat
 

Properties

Properties
id value
 
NSUInteger childrenCount
 
FIRDatabaseReferenceref
 
NSString * key
 
NSEnumerator * children
 
id priority
 

Detailed Description

A FIRDataSnapshot contains data from a Firebase Database location. Any time you read Firebase data, you receive the data as a FIRDataSnapshot.

FIRDataSnapshots are passed to the blocks you attach with observeEventType:withBlock: or observeSingleEvent:withBlock:. They are efficiently-generated immutable copies of the data at a Firebase Database location. They can't be modified and will never change. To modify data at a location, use a FIRDatabaseReference (e.g. with setValue:).

Method Documentation

- (FIRDataSnapshot *) childSnapshotForPath: (NSString *)  childPathString

Gets a FIRDataSnapshot for the location at the specified relative path. The relative path can either be a simple child key (e.g. 'fred') or a deeper slash-separated path (e.g. 'fred/name/first'). If the child location has no data, an empty FIRDataSnapshot is returned.

Parameters
childPathStringA relative path to the location of child data.
Returns
The FIRDataSnapshot for the child location.
- (BOOL) exists

Return YES if the DataSnapshot contains a non-null value.

Returns
YES if this snapshot contains a non-null value, else NO.
- (BOOL) hasChild: (NSString *)  childPathString

Return YES if the specified child exists.

Parameters
childPathStringA relative path to the location of a potential child.
Returns
YES if data exists at the specified childPathString, else NO.
- (BOOL) hasChildren

Return YES if the DataSnapshot has any children.

Returns
YES if this snapshot has any children, else NO.
- (id __nullable) valueInExportFormat

Returns the raw value at this location, coupled with any metadata, such as priority.

Priorities, where they exist, are accessible under the ".priority" key in instances of NSDictionary. For leaf locations with priorities, the value will be under the ".value" key.

Property Documentation

- (NSEnumerator*) children
readnonatomicstrong

An iterator for snapshots of the child nodes in this snapshot. You can use the native for..in syntax:

for (FIRDataSnapshot* child in snapshot.children) { ... }

Returns
An NSEnumerator of the children
- (NSUInteger) childrenCount
readnonatomicassign

Gets the number of children for this DataSnapshot.

Returns
An integer indicating the number of children.
- (NSString*) key
readnonatomicstrong

The key of the location that generated this FIRDataSnapshot.

Returns
An NSString containing the key for the location of this FIRDataSnapshot.
- (id) priority
readnonatomicstrong

The priority of the data in this FIRDataSnapshot.

Returns
The priority as a string, or nil if no priority was set.
- (FIRDatabaseReference*) ref
readnonatomicstrong

Gets a FIRDatabaseReference for the location that this data came from

Returns
A FIRDatabaseReference instance for the location of this data
- (id) value
readnonatomicstrong

Returns the contents of this data snapshot as native types.

Data types returned:

  • NSDictionary
  • NSArray
  • NSNumber (also includes booleans)
  • NSString
Returns
The data as a native object.

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