FirebaseFirestore Framework Reference

Classes

The following classes are available globally.

  • Represents an aggregation that can be performed by Firestore.

    Declaration

    Swift

    class AggregateField : NSObject
  • A query that calculates aggregations over an underlying query.

    Declaration

    Swift

    class AggregateQuery : NSObject
  • The results of executing an AggregateQuery.

    Declaration

    Swift

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

    Declaration

    Swift

    class CollectionReference : Query
  • 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

    Swift

    class DocumentChange : 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

    Swift

    class DocumentReference : 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

    Swift

    class DocumentSnapshot : 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

    Swift

    class QueryDocumentSnapshot : DocumentSnapshot
  • 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

    Swift

    class FieldPath : NSObject, NSCopying
  • Sentinel values that can be used when writing document fields with setData() or updateData().

    Declaration

    Swift

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

    Declaration

    Swift

    class Filter : NSObject
  • Firestore represents a Firestore Database and is the entry point for all Firestore operations.

    Declaration

    Swift

    class Firestore : NSObject
  • Settings used to configure a Firestore instance.

    Declaration

    Swift

    class FirestoreSettings : 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

    Swift

    class GeoPoint : NSObject, NSCopying
  • Represents a progress update or a final state from loading bundles.

    Declaration

    Swift

    class LoadBundleTaskProgress : 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

    Swift

    class LoadBundleTask : 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

    Swift

    class PersistentCacheSettings : NSObject, NSCopying, LocalCacheSettings
  • 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

    Swift

    class MemoryEagerGCSetting : NSObject, NSCopying, MemoryGarbageCollectorSettings
  • 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

    Swift

    class MemoryLRUGCSettings : NSObject, NSCopying, MemoryGarbageCollectorSettings
  • 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

    Swift

    class MemoryCacheSettings : NSObject, NSCopying, LocalCacheSettings
  • 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

    Swift

    class Query : 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

    Swift

    class QuerySnapshot : NSObject
  • Metadata about a snapshot, describing the state of the snapshot.

    Declaration

    Swift

    class SnapshotMetadata : NSObject
  • A Timestamp represents a point in time independent of any time zone or calendar, represented as seconds and fractions of seconds at nanosecond resolution in UTC Epoch time. It is encoded using the Proleptic Gregorian Calendar which extends the Gregorian calendar backwards to year one. It is encoded assuming all minutes are 60 seconds long, i.e. leap seconds are “smeared” so that no leap second table is needed for interpretation. Range is from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59.999999999Z. By restricting to that range, we ensure that we can convert to and from RFC 3339 date strings.

    Declaration

    Swift

    class Timestamp : NSObject, NSCopying
  • Transaction provides methods to read and write data within a transaction.

    See

    Firestore.runTransaction(_:)

    Declaration

    Swift

    class Transaction : NSObject
  • Options to customize the behavior of Firestore.runTransactionWithOptions().

    Declaration

    Swift

    class TransactionOptions : 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

    Swift

    class WriteBatch : NSObject