the.bay.news

Transitive protocol conformance requirement

Swift Forums
Transitive protocol conformance requirement
I have a use case where having a feature similar to Equatable, Hashable, Codable (perhaps a few others?) would help: transitive protocol conformance requirement. protocol P /* : TransitiveConformanceRequired */ {} extension Int: P {} // This should work seamlessly struct Foo: P { // ✅ var x: Int } // This should fail because 'Double' does not conform to P struct Bar: P { // ❌ Error: All fields must conform to P var x: Int var y: Double } I assume this is not possible in curre...

0 comments

Sign in to join the discussion — your thebay.events account works here.

No comments yet.