Jump to content
Sign in to follow this  
Rollo62

When will be binding to Swift libraries possible ?

Recommended Posts

Posted (edited)

Hi there,

 

it seems that Apple moves more and more from Objective-C to Swift,

especially for the new APIs, like RealityKit 2  https://developer.apple.com/documentation/realitykit.

 

That would mean Delphi / Firemonkey needs a way to bind with Swift, if no Objective-C might be available.

Has someone maybe checked about such Swift binding, and what pitfalls may be there ?

 

I would expect that Swift can handle more features, that cannot really converted to Delphi, but thats just my assumption.

Who could give more light to this ?

 

Edit:

I had an older post in the german DP, see here, as a kind of cross-post to this topic.

 

Edited by Rollo62

Share this post


Link to post
16 hours ago, Rollo62 said:

That would mean Delphi / Firemonkey needs a way to bind with Swift, if no Objective-C might be available.

 

There is QP report for that https://quality.embarcadero.com/browse/RSP-22944 

When will importing Swift frameworks be available, the is only that Embarcadero can tell. 

 

16 hours ago, Rollo62 said:

Has someone maybe checked about such Swift binding, and what pitfalls may be there ?

 

From what I can see, such Swift framework would have to be compiled in interop mode and Expose its API. Delphi is capable of importing Objective-C framework, so it is possible that @objc mode would suffice. If not there is unofficial @cdecl support, for Swift side.

 

https://forums.swift.org/t/best-way-to-call-a-swift-function-from-c/9829

 

This is not something I had need to explore, so this is all the information I can give.

  • Like 1

Share this post


Link to post

If the Swift framework does not support any explicit interop, it could be possibly wrapped and consumed through Objective-C library that can then be imported in Delphi https://developer.apple.com/documentation/swift/imported_c_and_objective-c_apis/importing_swift_into_objective-c

 

If you need support for Swift frameworks now, this sounds like most viable option.

Edited by Dalija Prasnikar

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×