firebase-ios-sdk
firebase-ios-sdk copied to clipboard
[FR]: Add `@discardableResult` to `CollectionReference.addDocument`
Description
Currently, when adding an Encodable document to a collection, the addDocument
method returns a DocumentReference
. Often this is not need and thus generates a warning in Xcode which can be silenced by
let _ = try Firestore.firestore().collection("collectionName").addDocument(from: encodable)
To improve developer experience I suggest to add the @discardableResult
attribute to the addDocument method which will tell the Swift compiler that it is okay for the return value to be unused.
See required changes here: https://github.com/Eskils/firebase-ios-sdk/commit/c44c187f92787b9978ba73e4bbbda14d6a78c665
API Proposal
No response
Firebase Product(s)
Firestore
I couldn't figure out how to label this issue, so I've labeled it for a human to triage. Hang tight.
If you want, you can create a PR. Otherwise, I can make the change.
Thanks!