Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FR]: Add @discardableResult to CollectionReference.addDocument #10640

Closed
Eskils opened this issue Jan 4, 2023 · 2 comments · Fixed by #10661 or #11151
Closed

[FR]: Add @discardableResult to CollectionReference.addDocument #10640

Eskils opened this issue Jan 4, 2023 · 2 comments · Fixed by #10661 or #11151

Comments

@Eskils
Copy link
Contributor

Eskils commented Jan 4, 2023

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: Eskils@c44c187

API Proposal

No response

Firebase Product(s)

Firestore

@google-oss-bot
Copy link

I couldn't figure out how to label this issue, so I've labeled it for a human to triage. Hang tight.

@wu-hui
Copy link
Contributor

wu-hui commented Jan 10, 2023

If you want, you can create a PR. Otherwise, I can make the change.

Thanks!

@firebase firebase locked and limited conversation to collaborators Feb 13, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
5 participants