Skip to content

Add conditional conformance to Hashable to Firestore property wrapper types #6249

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

Merged
merged 9 commits into from
Aug 12, 2020

Conversation

wilhuff
Copy link
Contributor

@wilhuff wilhuff commented Aug 10, 2020

Mark these types as conforming to Hashable if the underlying type itself conforms to Hashable. This implementation relies on synthesized Equatable and Hashable conformance that shipped as a part of Swift 4.1.

Fixes #6237.

This turns out not to actually work because NSDate does not conform to
Codable. Users can supply their own extensions that make NSDate conform
to Codable and also supply an extension like this one to make NSDate
conform to ServerTimestampWrappable.

Add a test that verifies ServerTimestamps of Dates actually work. The
equivalent test for NSDate does not compile.
FirebaseFirestoreSwift was already using synthesized Equatable and
Hashable conformance which requires Swift 4.1.
… types

Mark these types as conforming to Hashable if the underlying type itself
conforms to hashable. This implementation relies on synthesized
Equatable and Hashable conformance that shipped as a part of Swift 4.1.
@wilhuff wilhuff changed the base branch from wilhuff/swift-version to master August 10, 2020 23:17
@wu-hui wu-hui merged commit 73fcb19 into master Aug 12, 2020
@wilhuff wilhuff deleted the wilhuff/hashable branch August 12, 2020 19:24
@firebase firebase locked and limited conversation to collaborators Sep 12, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add Hashable conformance to firestoreswift property wrappers
3 participants