Optionals Should Conditionally Conform to Hashable

With Swift 4.1, on XCode 9.3 beta (9Q98q)

The following does not compile:

struct MyStruct: Hashable {
    let prop1: String?
}

error: type 'MyStruct' does not conform to protocol 'Hashable'

Is this due to String? / Optional not being hashable?

Indeed it is! We are discussing adding Hashable conformance to Optional on this thread:

2 Likes

Ah, thank you.