FirebaseFirestore Framework Reference

Protocols

The following protocols are available globally.

  • Represents a listener that can be removed by calling remove.

    Declaration

    Swift

    protocolListenerRegistration:NSObjectProtocol
  • Marker protocol implemented by all supported cache settings.

    The two cache types supported arePersistentCacheSettings andMemoryCacheSettings. Custom implementation is not supported.

    Declaration

    Swift

    protocolLocalCacheSettings
  • Marker protocol implemented by all supported garbage collector settings.

    The two cache types supported areMemoryEagerGCSettings andMemoryLRUGCSettings. Custom implementation is not supported.

    Declaration

    Swift

    protocolMemoryGarbageCollectorSettings
  • A type that can initialize itself from a FirestoreDocumentReference,which makes it suitable for use with the@DocumentID property wrapper.

    Firestore includes extensions that makeString andDocumentReferenceconform toDocumentIDWrappable.

    Note that Firestore ignores fields annotated with@DocumentID when writingso there is no requirement to convert from the wrapped type back to aDocumentReference.

    Declaration

    Swift

    publicprotocolDocumentIDWrappable
  • A type that can initialize itself from a Firestore Timestamp, which makesit suitable for use with the@ServerTimestamp property wrapper.

    Firestore includes extensions that makeTimestamp andDate conform toServerTimestampWrappable.

    Declaration

    Swift

    publicprotocolServerTimestampWrappable
  • Undocumented

    Declaration

    Swift

    publicprotocolExpression:Sendable
  • ABooleanExpression is anExpression that evaluates to a boolean value.

    It is used to construct conditional logic within Firestore pipelines, such as inwhereclauses orConditionalExpression.BooleanExpression instances can be combined using standardlogical operators (&&,||,!,^) to create complex conditions.

    Example usage in awhere clause:

    firestore.pipeline().collection("products").where(Field("price").greaterThan(100)&&(Field("category").equal("electronics")||Field("on_sale").equal(true)))

    Declaration

    Swift

    publicprotocolBooleanExpression:Expression
  • A protocol for expressions that have a name.

    Selectable is adopted by expressions that can be used in pipeline stages where a named outputis required, such asselect anddistinct.

    AField is aSelectable where the name is the field path.

    An expression can be madeSelectable by giving it an alias using the.as() method.

    Declaration

    Swift

    publicprotocolSelectable:Sendable

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 2026-01-13 UTC.