I want to extend a protocol to satisfy one of multiple constraints. I know how to satisfy multiple constraints with (,), but that would conform to all of them.
Example:
protocol Abc { ... }
protocol xyz { ... }
protocol my { ... }
extenstion Abc where Self: xyz, Self: my {
...
}
I want Abc
to either conform to xyz
or my
.
I think you can use a common protocol to do this:
protocol Common { }
protocol Abc { }
protocol xyz: Common { }
protocol my: Common { }
extension Abc where Self: Common {
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With