2

I have declared an initializer in an extension on a built in protocol type.

extension SomeProtocol {
    init(fromData: Data) { // my code here }
}

A framework that I use also declares an initializer for the same protocol with the same function signature.

So when I try to invoke my initializer, I get an error about ambiguity:

let myObject = SomeProtocolConformingObject(fromData: data) // error

I know that you can specify top-level functions from a framework like so:

SomeFramework.topLevelFunction()

But how can I specify to use my initializer or the framework's initializer without changing the function signature?

Tim Fuqua
  • 1,635
  • 1
  • 16
  • 25

0 Answers0