I'm working on rewriting an Objective-C project in Swift and I got stuck in a compiler error. I'm calling a method defined into a Objective-C protocol which has the signature:
- (void)startForBuilder:(Object*)builder;
and from Swift I'm calling this method like:
plugin.start(for: self)
where self
is an instance of Object and plugin is an instance of an object which conforms to the protocol above. The error I'm getting is
Cannot convert value of type 'Object' to expected argument type 'Object!'
Replacing self
with self!
didn't work (because self
is not an optional, obviously), I also tried to instantiate another object of the same type as self
and use that instance as argument to check if the error disappears, but it's still there.
What could cause this error?