We're going to have to write a C library and this library has to be accessible from Objective-C. Now I don't know anything about Objective-C so I wonder how simple Objective-C <-> C interoperability is. Is that as simple as including the C header in the Objective-C code and linking to the library? Is there anything special I'm supposed to do (like the extern "C"
bit with C++)?
To use Objective-C code in Swift, it is only necessary to import Objective-C header file in bridging header file to expose it to Swift. If you are working on a framework, you will need to import Objective-C in umbrella header since bridging headers are not available for frameworks.
To sum it up, Objective-C, when compared to Swift, is a more outdated language and lacks modern tools and properties.
You can use Objective-C and Swift files together in a single project, no matter which language the project used originally. This makes creating mixed-language app and framework targets as straightforward as creating an app or framework target written in a single language.
If Swift succeeds, Objective-C will go away. It won't be deprecated, but it'll move to Florida to enjoy its golden years.
Objective-C is a strict superset of C. You don't need to use extern "C"
or anything like that.
Objective-C is a strict superset of GNU C (note, this is not the same as ISO C90).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With