<story><title>Yak Shaving – Swift Edition</title><url>https://tirania.org/blog/archive/2020/Mar-24.html</url></story><parent_chain></parent_chain><comment><author>rvz</author><text>&amp;gt; What won my heart is just how simple it is to import C code into Swift to bring the type definitions from a header file, and call into the C code transparently from Swift. This really is a gift of the gods to humankind.&lt;p&gt;If you like creating wrappers around C libraries, perhaps this is the most overlooked feature in Swift, called the &amp;#x27;ClangImporter&amp;#x27;. Compared with Rust&amp;#x27;s bindgen, bindgen looks like a more complicated bindings generator even at the C level with you tweaking the options and other knobs to &amp;#x27;get it right&amp;#x27; for your specific wrapper project.&lt;p&gt;This is before you even start to write a higher-level and more idiomatic wrapper and ClangInporter binds the C part to generate Swift functions for you by default. Similarly, Zig also has this too which is &amp;quot;@cImport&amp;quot; with the path to the header file as the input IIRC.&lt;p&gt;It also looks like Swift is getting C++ interop for this too. [0]&lt;p&gt;[0] &lt;a href=&quot;https:&amp;#x2F;&amp;#x2F;forums.swift.org&amp;#x2F;t&amp;#x2F;manifesto-interoperability-between-swift-and-c&amp;#x2F;33874&quot; rel=&quot;nofollow&quot;&gt;https:&amp;#x2F;&amp;#x2F;forums.swift.org&amp;#x2F;t&amp;#x2F;manifesto-interoperability-betwee...&lt;/a&gt;</text></comment>
<story><title>Yak Shaving – Swift Edition</title><url>https://tirania.org/blog/archive/2020/Mar-24.html</url></story><parent_chain></parent_chain><comment><author>sgt</author><text>Miguel taking an interest in Swift is interesting on its own!</text></comment>