Calling back and forth between Swift, Objective-C, C, C++, Rust, Go, ...?

Is there any training or books on Kodeco (or elsewhere) that do a good job explaining the ins and outs of cross-language concerns? Occasionally Swift code needs to deal with odd Objective-C data structures or I need to use a C or C++ framework. Or even worse, I have to provide a program in Go or Rust and want to use things like SwiftUI and Metal. There are open source projects out there but I frequently hit bugs and just want to control my own destiny and really have a solid understanding of all of the concerns.

Any pointers would be greatly appreciated.

~chuck

Objective-C and Swift together are well documented and supported, you can even call Swift from Objective-C:

https://developer.apple.com/documentation/swift/importing-objective-c-into-swift

https://developer.apple.com/documentation/swift/importing-swift-into-objective-c

It gets tricky when handling pointers in Swift (unsafe types), but in general bridging headers will be your friends and everything works out of the box. (Edit Added) C and C++ are supported by Xcode and while I have only done C, I understand that C++ and Objective-C++ are also supported using the same techniques.

As for other languages, JavaScript and Kotlin Native may get your partly there, but there isn’t much.

This topic was automatically closed after 166 days. New replies are no longer allowed.