I'm seeking some advice regarding conforming types that I do not own to protocols defined in my Swift packages. Specifically, I'm wondering about the best way to go about providing conformances for types which otherwise my package does not require.
Let's say MyPackage
vends protocol Foo
. Imagine that it is often desirable for OrderedDictionary
to conform to Foo
. MyPackage
does not make use of OrderedDictionary
, and clients of MyPackage
will of course not always need OrderedDictionary
in their code, but in the case that they do need it, it would be desirable for it to conform to Foo
. I know that in general it is bad practice to conform types that you do not own to protocols that you do not own, which would imply that MyPackage
should supply the conformance of OrderedDictionary
to Foo
. However, I do not want to force a dependency on swift-collections
onto all of the clients of MyPackage
.
I'm looking for opinions and advice regarding the best way to handle this type of situation.