firebase / firebase/firebase-ios-sdk

FR: Support Codable in Document Update

Open
#9,403 7 comments 4 reactions 0 assignees View on GitHub
api: firestore Swift API type: feature request
Dominant language
C++
Stars
6.7k
Forks
1.8k
Avg merge
2d 14h
Merged PRs (30d)
72

Description

### Feature proposal

* Firebase Component: Firestore

Currently Codable in Swift works for `setData(from: Codable)`, but there is no equivalent `updateData(from Codable)`.

This means that if you you want to update a document that is represented by a `Codable` type, there is no straightforward way to update the document. Using `setData` again is not a good option either, as other clients will see that as an `added` event and not a `modified` event.

Additionally, using Codable encodes `Date` as a `FIRTimestamp`, but manually converting a Codable object to `[AnyHashable: Any]` using `JSONSerialization` erases these types and instead encodes it as `Double`, breaking other feature such as using a listener with a date filter.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.