Calling a Native Function in Swift in XCode 10.1

A client recently asked us to implement a Photo Editor SDK into his Unity game. The SDK supports swift and Objective-C. I have never programmed in any of them, hence, I thought I could give Swift a try. The problem is that I couldn’t find up to date information on this issue. I know that a wrapper class in Obj-C is needed to call the swift method. Any of you has an idea about the syntax or the workflow to follow? Thanks.

You might want to take a look at Native Plugins

Hi @PavelLU , I have looked at it and did all my native code in Objective C. The thing is, that there is no official documentation for creating a bridge between objective c and swift for native plugins. As far as I Know, Objective C is deprecated, and I was looking for a little guide on how to set this up. If you have a lead It would be really helpful.

Cheers.

Since Unity iOS Trampoline part is written in Objective-C and plugin you mentioned also have Objective-C interface it make sense to go with Objective-C. (AFAIK no risk for Objective-C to go away in near term)

Thank you @PavelLU for your quick response, I guess Ill improve my Objective C skills during this project.

I’ve had success following this article in trying to call Swift code from a Unity iOS plugin: