Enumerations

The following enumerations are available globally.

  • An enumeration of document change types.

    Declaration

    Swift

    enum DocumentChangeType : Int
  • Controls the return value for server timestamps that have not yet been set to their final value.

    Declaration

    Swift

    enum ServerTimestampBehavior : Int
  • Error codes used by Cloud Firestore.

    Declaration

    Swift

    enum FirestoreErrorCode : Int
  • An enum that configures the behavior of DocumentReference.getDocument() and Query.getDocuments(). By providing a source enum the getDocument[s] methods can be configured to fetch results only from the server, only from the local cache, or attempt to fetch results from the server and fall back to the cache (which is the default).

    Setting the source to Source.default causes Firestore to try to retrieve an up-to-date (server-retrieved) snapshot, but fall back to returning cached data if the server can’t be reached.

    Setting the source to Source.server causes Firestore to avoid the cache, generating an error if the server cannot be reached. Note that the cache will still be updated if the server request succeeds. Also note that latency-compensation still takes effect, so any pending write operations will be visible in the returned data (merged into the server-provided data).

    Setting the source to Source.cache causes Firestore to immediately return a value from the cache, ignoring the server completely (implying that the returned value may be stale with respect to the value on the server). If there is no data in the cache to satisfy the getDocument[s] call, DocumentReference.getDocument() will return an error and QuerySnapshot.getDocuments() will return an empty QuerySnapshot with no documents.

    Declaration

    Swift

    enum FirestoreSource : UInt