FirebaseFirestore Framework Reference

Classes

The following classes are available globally.

  • Represents an aggregation that can be performed by Firestore.

    Declaration

    Objective-C

    
    @interface FIRAggregateField : NSObject
  • A query that calculates aggregations over an underlying query.

    Declaration

    Objective-C

    
    @interface FIRAggregateQuery : NSObject
  • The results of executing an AggregateQuery.

    Declaration

    Objective-C

    
    @interface FIRAggregateQuerySnapshot : NSObject
  • A CollectionReference object can be used for adding documents, getting document references, and querying for documents (using the methods inherited from Query).

    Declaration

    Objective-C

    
    @interface FIRCollectionReference : FIRQuery
  • A DocumentChange represents a change to the documents matching a query. It contains the document affected and the type of change that occurred (added, modified, or removed).

    Declaration

    Objective-C

    
    @interface FIRDocumentChange : NSObject
  • A DocumentReference refers to a document location in a Firestore database and can be used to write, read, or listen to the location. The document at the referenced location may or may not exist. A DocumentReference can also be used to create a CollectionReference to a subcollection.

    Declaration

    Objective-C

    
    @interface FIRDocumentReference : NSObject
  • A DocumentSnapshot contains data read from a document in your Firestore database. The data can be extracted with the data property or by using subscript syntax to access a specific field.

    For a DocumentSnapshot that points to a non-existing document, any data access will return nil. You can use the exists property to explicitly verify a documents existence.

    Declaration

    Objective-C

    
    @interface FIRDocumentSnapshot : NSObject
  • A QueryDocumentSnapshot contains data read from a document in your Firestore database as part of a query. The document is guaranteed to exist and its data can be extracted with the data property or by using subscript syntax to access a specific field.

    A QueryDocumentSnapshot offers the same API surface as a DocumentSnapshot. As deleted documents are not returned from queries, its exists property will always be true and data() will never return nil.

    Declaration

    Objective-C

    
    @interface FIRQueryDocumentSnapshot : FIRDocumentSnapshot
  • A FieldPath refers to a field in a document. The path may consist of a single field name (referring to a top level field in the document), or a list of field names (referring to a nested field in the document).

    Declaration

    Objective-C

    
    @interface FIRFieldPath : NSObject <NSCopying>
  • Sentinel values that can be used when writing document fields with setData() or updateData().

    Declaration

    Objective-C

    
    @interface FIRFieldValue : NSObject
  • A Filter represents a restriction on one or more field values and can be used to refine the results of a Query.

    Declaration

    Objective-C

    
    @interface FIRFilter : NSObject
  • Firestore represents a Firestore Database and is the entry point for all Firestore operations.

    Declaration

    Objective-C

    
    @interface FIRFirestore : NSObject
  • Settings used to configure a Firestore instance.

    Declaration

    Objective-C

    
    @interface FIRFirestoreSettings : NSObject <NSCopying>
  • An immutable object representing a geographical point in Firestore. The point is represented as a latitude/longitude pair.

    Latitude values are in the range of [-90, 90]. Longitude values are in the range of [-180, 180].

    Declaration

    Objective-C

    
    @interface FIRGeoPoint : NSObject <NSCopying>
  • Represents a progress update or a final state from loading bundles.

    Declaration

    Objective-C

    
    @interface FIRLoadBundleTaskProgress : NSObject
  • Represents the task of loading a Firestore bundle. Observers can be registered with this task to observe the bundle loading progress, as well as task completion and error events.

    Declaration

    Objective-C

    
    @interface FIRLoadBundleTask : NSObject
  • Configures the SDK to use a persistent cache. Firestore documents and mutations are persisted across App restart.

    This is the default cache type unless explicitly specified otherwise.

    To use, create an instance using one of the initializers, then set the instance to FirestoreSettings.cacheSettings, and use FirestoreSettings instance to configure Firestore SDK.

    Declaration

    Objective-C

    
    @interface FIRPersistentCacheSettings
        : NSObject <NSCopying, FIRLocalCacheSettings>
  • Configures the SDK to use an eager garbage collector for memory cache.

    Once configured, the SDK will remove any Firestore documents from memory as soon as they are not used by any active queries.

    To use, create an instance using the initializer, then initialize MemoryCacheSettings with this instance. This is the default garbage collector, so alternatively you can use the default initializer of MemoryCacheSettings.

    Declaration

    Objective-C

    
    @interface FIRMemoryEagerGCSettings
        : NSObject <NSCopying, FIRMemoryGarbageCollectorSettings>
  • Configures the SDK to use a least-recently-used garbage collector for memory cache.

    Once configured, the SDK will attempt to remove documents that are least recently used in batches, if the current cache size is larger than the given target cache size. Default cache size is 100MB.

    To use, create an instance using one of the initializers, then initialize MemoryCacheSettings with this instance.

    Declaration

    Objective-C

    
    @interface FIRMemoryLRUGCSettings
        : NSObject <NSCopying, FIRMemoryGarbageCollectorSettings>
  • Configures the SDK to use a memory cache. Firestore documents and mutations are NOT persisted across App restart.

    To use, create an instance using one of the initializer, then set the instance to FirestoreSettings.cacheSettings, and use FirestoreSettings instance to configure Firestore SDK.

    Declaration

    Objective-C

    
    @interface FIRMemoryCacheSettings : NSObject <NSCopying, FIRLocalCacheSettings>
  • Undocumented

    Declaration

    Objective-C

    @interface FIRExprBridge : NSObject
    @end
  • Undocumented

    Declaration

    Objective-C

    @interface FIRFieldBridge : FIRExprBridge
    - (id)initWithName:(NSString *)name;
    - (id)initWithPath:(FIRFieldPath *)path;
    - (NSString *)field_name;
    @end
  • Undocumented

    Declaration

    Objective-C

    @interface FIRConstantBridge : FIRExprBridge
    - (id)init:(id)input;
    @end
  • Undocumented

    Declaration

    Objective-C

    @interface FIRFunctionExprBridge : FIRExprBridge
    - (id)initWithName:(NSString *)name Args:(NSArray<FIRExprBridge *> *)args;
    @end
  • Undocumented

    Declaration

    Objective-C

    @interface FIRAggregateFunctionBridge : NSObject
    - (id)initWithName:(NSString *)name Args:(NSArray<FIRExprBridge *> *)args;
    @end
  • Undocumented

    Declaration

    Objective-C

    @interface FIROrderingBridge : NSObject
    - (id)initWithExpr:(FIRExprBridge *)expr Direction:(NSString *)direction;
    @end
  • Undocumented

    Declaration

    Objective-C

    @interface FIRStageBridge : NSObject
    @property(nonatomic, readonly) NSString *name;
    @end
  • Undocumented

    Declaration

    Objective-C

    @interface FIRCollectionSourceStageBridge : FIRStageBridge
    
    - (id)initWithRef:(FIRCollectionReference *)ref firestore:(FIRFirestore *)db;
    @end
  • Undocumented

    Declaration

    Objective-C

    @interface FIRDatabaseSourceStageBridge : FIRStageBridge
    
    - (id)init;
    @end
  • Undocumented

    Declaration

    Objective-C

    @interface FIRCollectionGroupSourceStageBridge : FIRStageBridge
    
    - (id)initWithCollectionId:(NSString *)id;
    @end
  • Undocumented

    Declaration

    Objective-C

    @interface FIRDocumentsSourceStageBridge : FIRStageBridge
    
    - (id)initWithDocuments:(NSArray<FIRDocumentReference *> *)documents firestore:(FIRFirestore *)db;
    @end
  • Undocumented

    Declaration

    Objective-C

    @interface FIRWhereStageBridge : FIRStageBridge
    
    - (id)initWithExpr:(FIRExprBridge *)expr;
    @end
  • Undocumented

    Declaration

    Objective-C

    @interface FIRLimitStageBridge : FIRStageBridge
    
    - (id)initWithLimit:(NSInteger)value;
    @end
  • Undocumented

    Declaration

    Objective-C

    @interface FIROffsetStageBridge : FIRStageBridge
    
    - (id)initWithOffset:(NSInteger)value;
    @end
  • Undocumented

    Declaration

    Objective-C

    @interface FIRAddFieldsStageBridge : FIRStageBridge
    - (id)initWithFields:(NSDictionary<NSString *, FIRExprBridge *> *)fields;
    @end
  • Undocumented

    Declaration

    Objective-C

    @interface FIRRemoveFieldsStageBridge : FIRStageBridge
    - (id)initWithFields:(NSArray<NSString *> *)fields;
    @end
  • Undocumented

    Declaration

    Objective-C

    @interface FIRSelectStageBridge : FIRStageBridge
    - (id)initWithSelections:(NSDictionary<NSString *, FIRExprBridge *> *)selections;
    @end
  • Undocumented

    Declaration

    Objective-C

    @interface FIRDistinctStageBridge : FIRStageBridge
    - (id)initWithGroups:(NSDictionary<NSString *, FIRExprBridge *> *)groups;
    @end
  • Undocumented

    Declaration

    Objective-C

    @interface FIRAggregateStageBridge : FIRStageBridge
    - (id)initWithAccumulators:(NSDictionary<NSString *, FIRAggregateFunctionBridge *> *)accumulators
                        groups:(NSDictionary<NSString *, FIRExprBridge *> *)groups;
    @end
  • Undocumented

    Declaration

    Objective-C

    @interface FIRFindNearestStageBridge : FIRStageBridge
    - (id)initWithField:(FIRFieldBridge *)field
            vectorValue:(FIRVectorValue *)vectorValue
        distanceMeasure:(NSString *)distanceMeasure
                  limit:(NSNumber *_Nullable)limit
          distanceField:(FIRExprBridge *_Nullable)distanceField;
    @end
  • Undocumented

    Declaration

    Objective-C

    @interface FIRSorStageBridge : FIRStageBridge
    - (id)initWithOrderings:(NSArray<id> *)orderings;
    @end
  • Undocumented

    Declaration

    Objective-C

    @interface FIRReplaceWithStageBridge : FIRStageBridge
    - (id)initWithExpr:(FIRExprBridge *)expr;
    @end
  • Undocumented

    Declaration

    Objective-C

    @interface FIRSampleStageBridge : FIRStageBridge
    - (id)initWithCount:(int64_t)count;
    - (id)initWithPercentage:(double)percentage;
    @end
  • Undocumented

    Declaration

    Objective-C

    @interface FIRUnionStageBridge : FIRStageBridge
    - (id)initWithOther:(FIRPipelineBridge *)other;
    @end
  • Undocumented

    Declaration

    Objective-C

    @interface FIRUnnestStageBridge : FIRStageBridge
    - (id)initWithField:(FIRExprBridge *)field
                  alias:(FIRExprBridge *)alias
             indexField:(FIRExprBridge *_Nullable)index_field;
    @end
  • Undocumented

    Declaration

    Objective-C

    @interface FIRRawStageBridge : FIRStageBridge
    - (id)initWithName:(NSString *)name
                params:(NSArray<id> *)params
               options:(NSDictionary<NSString *, FIRExprBridge *> *_Nullable)options;
    @end
  • Undocumented

    Declaration

    Objective-C

    @interface __FIRPipelineResultBridge : NSObject
    
    @property(nonatomic, strong, readonly, nullable) FIRDocumentReference *reference;
    
    @property(nonatomic, copy, readonly, nullable) NSString *documentID;
    
    @property(nonatomic, strong, readonly, nullable) FIRTimestamp *create_time;
    
    @property(nonatomic, strong, readonly, nullable) FIRTimestamp *update_time;
    
    - (NSDictionary<NSString *, id> *)data;
    
    - (NSDictionary<NSString *, id> *)dataWithServerTimestampBehavior:
        (FIRServerTimestampBehavior)serverTimestampBehavior;
    
    - (nullable id)get:(id)field;
    
    - (nullable id)get:(id)field
        serverTimestampBehavior:(FIRServerTimestampBehavior)serverTimestampBehavior;
    
    @end
  • Undocumented

    Declaration

    Objective-C

    @interface __FIRPipelineResultChangeBridge : NSObject
    
    /** The type of change that occurred (added, modified, or removed). */
    @property(nonatomic, readonly) FIRDocumentChangeType type;
    
    /** The document affected by this change. */
    @property(nonatomic, strong, readonly) __FIRPipelineResultBridge *result;
    
    @property(nonatomic, readonly) NSUInteger oldIndex;
    
    @property(nonatomic, readonly) NSUInteger newIndex;
    
    @end
  • Undocumented

    Declaration

    Objective-C

    @interface __FIRPipelineSnapshotBridge : NSObject
    
    @property(nonatomic, strong, readonly) NSArray<__FIRPipelineResultBridge *> *results;
    
    @property(nonatomic, strong, readonly) FIRTimestamp *execution_time;
    
    @end
  • Undocumented

    Declaration

    Objective-C

    @interface FIRPipelineBridge : NSObject
    
    /** :nodoc: */
    - (id)initWithStages:(NSArray<FIRStageBridge *> *)stages db:(FIRFirestore *)db;
    
    - (void)executeWithCompletion:(void (^)(__FIRPipelineSnapshotBridge *_Nullable result,
                                            NSError *_Nullable error))completion;
    
    + (NSArray<FIRStageBridge *> *)createStageBridgesFromQuery:(FIRQuery *)query;
    @end
  • Undocumented

    Declaration

    Objective-C

    @interface __FIRRealtimePipelineSnapshotBridge : NSObject
    
    @property(nonatomic, strong, readonly) NSArray<__FIRPipelineResultBridge *> *results;
    
    @property(nonatomic, strong, readonly) NSArray<__FIRPipelineResultChangeBridge *> *changes;
    
    @property(nonatomic, strong, readonly) FIRSnapshotMetadata *metadata;
    
    @end
  • Undocumented

    Declaration

    Objective-C

    @interface __FIRPipelineListenOptionsBridge : NSObject
    
    @property(nonatomic, readonly) NSString *serverTimestampBehavior;
    @property(nonatomic, readonly) BOOL includeMetadata;
    @property(nonatomic, readonly) FIRListenSource source;
    - (instancetype)initWithServerTimestampBehavior:(NSString *)serverTimestampBehavior
                                    includeMetadata:(BOOL)includeMetadata
                                             source:(FIRListenSource)source NS_DESIGNATED_INITIALIZER;
    
    /**
     * The default initializer is unavailable. Please use the designated initializer.
     */
    - (instancetype)init NS_UNAVAILABLE;
    
    @end
  • Undocumented

    Declaration

    Objective-C

    @interface FIRRealtimePipelineBridge : NSObject
    
    /** :nodoc: */
    - (id)initWithStages:(NSArray<FIRStageBridge *> *)stages db:(FIRFirestore *)db;
    
    - (id<FIRListenerRegistration>)
        addSnapshotListenerWithOptions:(__FIRPipelineListenOptionsBridge *)options
                              listener:
                                  (void (^)(__FIRRealtimePipelineSnapshotBridge *_Nullable snapshot,
                                            NSError *_Nullable error))listener
        NS_SWIFT_NAME(addSnapshotListener(options:listener:));
    
    @end
  • A Query refers to a query which you can read or listen to. You can also construct refined Query objects by adding filters and ordering.

    Declaration

    Objective-C

    
    @interface FIRQuery : NSObject
  • A QuerySnapshot contains zero or more DocumentSnapshot objects. It can be enumerated using the documents property and its size can be inspected with isEmpty and count.

    Declaration

    Objective-C

    
    @interface FIRQuerySnapshot : NSObject
  • Options to configure the behavior of Firestore.addSnapshotListenerWithOptions(). Instances of this class control settings like whether metadata-only changes trigger events and the preferred data source.

    Declaration

    Objective-C

    
    @interface FIRSnapshotListenOptions : NSObject
  • Metadata about a snapshot, describing the state of the snapshot.

    Declaration

    Objective-C

    
    @interface FIRSnapshotMetadata : NSObject
  • Transaction provides methods to read and write data within a transaction.

    See

    Firestore.runTransaction(_:)

    Declaration

    Objective-C

    
    @interface FIRTransaction : NSObject
  • Options to customize the behavior of Firestore.runTransactionWithOptions().

    Declaration

    Objective-C

    
    @interface FIRTransactionOptions : NSObject <NSCopying>
  • A write batch is used to perform multiple writes as a single atomic unit.

    A WriteBatch object can be acquired by calling Firestore.batch(). It provides methods for adding writes to the write batch. None of the writes will be committed (or visible locally) until WriteBatch.commit() is called.

    Unlike transactions, write batches are persisted offline and therefore are preferable when you don’t need to condition your writes on read data.

    Declaration

    Objective-C

    
    @interface FIRWriteBatch : NSObject