New little gem in Swift 6.3

Just found on Swift 6.3 Released | Swift.org blog that Swift now supports the new @c attribute. Many thanks to the Swift developers for implementing this little gem! It allows C interoperability without enabling C++ interoperability and without the need to use the undocumented @_cdecl attribute.

Before that, it was impossible to generate C compatible header file without enabling C++ interoperability (only Objective-C compatible header was generated in this case, at least in my experience).

With the new @c attribute in my case the size of the generated C header file goes down to 13KB from 180KB (because C++ interop is disabled and the header file does not include C++ related things).

17 Likes