FirebaseDatabase Framework Reference

Classes

The following classes are available globally.

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

    DataSnapshots are passed to the blocks you attach withobserve(_:with:) orobserveSingleEvent(of:with:). 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 DatabaseReference (e.g. withsetValue(_:)).

    Declaration

    Objective-C

    @interfaceFIRDataSnapshot:NSObject
  • The entry point for accessing a Firebase Database. You can get an instanceby callingDatabase.database(). To access a location in the database andread or write data, useFIRDatabase.reference().

    Declaration

    Objective-C

    @interfaceFIRDatabase:NSObject
  • ADatabaseQuery instance represents a query over the data at a particular location.

    You create one by calling one of the query methods (queryOrdered(byChild:),queryStarting(atValue:), etc.) on aDatabaseReference. The query methods can be chained to further specify the data you are interested in observing.

    Declaration

    Objective-C

    @interfaceFIRDatabaseQuery:NSObject
  • A FIRDatabaseReference represents a particular location in your Firebase Database and can be used for reading or writing data to that Firebase Database location.

    This class is the starting point for all Firebase Database operations. After you’ve obtained your first FIRDatabaseReference via [FIRDatabase reference], you can use it to read data (ie. observeEventType:withBlock:), write data (ie. setValue:), and to create new FIRDatabaseReferences (ie. child:).

    Declaration

    Objective-C

    @interfaceFIRDatabaseReference:FIRDatabaseQuery
  • AMutableData instance is populated with data from a Firebase Database location. When you are usingrunTransactionBlock(_:), 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 usingTransactionResult.success(withValue:).

    To modify the data, set its value property to any of the Objective-C types supported by Firebase Database, or any equivalent natively bridgeable Swift type:

    • NSNumber (includes booleans)
    • NSDictionary
    • NSArray
    • NSString
    • nil /NSNull to remove the data

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

    Declaration

    Objective-C

    @interfaceFIRMutableData:NSObject
  • Placeholder values you may write into Firebase Database as a value orpriority that will automatically be populated by the Firebase Databaseserver.

    Declaration

    Objective-C

    @interfaceFIRServerValue:NSObject
  • Used forrunTransactionBlock(_:). ATransactionResult instance is acontainer for the results of the transaction.

    Declaration

    Objective-C

    @interfaceFIRTransactionResult:NSObject

Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2025-03-11 UTC.