2

Hello my goal here is to extend (in swift 3) a protocol I have in a framework to conform to another Protocol

protocol SomeProtocol {}
protocol SomeOtherProtocol {}
extension SomeOtherProtocol: SomeProtocol {}

The problem here is that I get an error: "Extension of protocol 'SomeOtherProtocol' cannot have an inheritance clause" If this is not possible how do I achieve such thing or what's the "swift way"?

Massimo
  • 159
  • 1
  • 10
  • 1
    That's just not possible. Consider what that would mean: Say I had a class `C` which conforms to `SomeOtherProtocol `. When you extend `SomeOtherProtocol` with a conformance to `SomeProtocol`, `C` will be unable to conform after this change. – Alexander Jun 08 '17 at 02:17
  • Ah that's a good point. Thanks – Massimo Jun 08 '17 at 18:06
  • 1
    You'll have to go around and extend the concrete types that conform to `SomeOtherProtocol` and make them conform to `SomeProtocol` on a case-by-case basis – Alexander Jun 08 '17 at 18:24

0 Answers0