Conforming to Hashable protocol?
You're missing the declaration:
struct DateStruct: Hashable {
And your ==
function is wrong. You should compare the three properties.
static func == (lhs: DateStruct, rhs: DateStruct) -> Bool { return lhs.year == rhs.year && lhs.month == rhs.month && lhs.day == rhs.day}
It's possible for two different values to have the same hash value.
If you don't want to use the hashValue, you can combine the hash of your values with the hash(into:)
method.
For more information see the answer : https://stackoverflow.com/a/55118328/1261547