Swiftgram/TDLibKit

Data types conform to `Hashable` and `Identifiable`?

Closed this issue · 1 comments

laosb commented

When integrating with SwiftUI, it would be very helpful if data types like StickerSetInfo and File conform to Hashable, and for data types with an id field, also conform to Identifiable.

As a example: The new SwiftUI NavigationLink value + .navigationDestination initializer requires the value conforms to Hashable, and in ForEach and List, you can save the use of key: when elements conform to Identifiable.

Considering automatic synthesis of Hashable requirements is only available when declared in the same file, it will be a very tedious job of "implementing" a hash(into:) which basically manually hasher.combine() every field, if I want to achieve Hashable conformance without changing TDLibKit.

Added in #32