FirebaseFirestoreSwift Framework Reference

ExplicitNull

@propertyWrapper
public struct ExplicitNull<Value>
extension ExplicitNull: Equatable where Value: Equatable
extension ExplicitNull: Hashable where Value: Hashable
extension ExplicitNull: Encodable where Value: Encodable
extension ExplicitNull: Decodable where Value: Decodable

Wraps an Optional field in a Codable object such that when the field has a nil value it will encode to a null value in Firestore. Normally, optional fields are omitted from the encoded document.

This is useful for ensuring a field is present in a Firestore document, even when there is no associated value.

  • Declaration

    Swift

    public func encode(to encoder: Encoder) throws
  • Declaration

    Swift

    public init(from decoder: Decoder) throws