<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
  <title type="text" xml:lang="en">Swift.org</title>
  <link type="application/atom+xml" href="https://swift.org/atom.xml" rel="self"/>
  <link type="text/html" href="" rel="alternate"/>
  <updated>2026-09-12T04:34:04-04:00</updated>
  <id>tag:swift.org,2015-12-03:Swift</id>

  
  
  <entry>
    <title>Module Tracking in Swift Debug Info</title>
    
      
        
        <author>
        
          <name>Adrian Prantl</name>
        
        </author>
      
    
    <link href="https://swift.org/blog/module-tracking-in-debug-info/"/>
    <updated>2026-09-11T11:30:00-04:00</updated>
    <id>https://swift.org/blog/module-tracking-in-debug-info/</id>
    <content type="html">&lt;p&gt;When your Swift program hits a breakpoint and stops so you can inspect it, the debugger’s expression evaluator has to find the exact Swift module your code was built from. Until now, that lookup wasn’t always precise. The upcoming Swift 6.4 release will include changes, begun in Swift 6.3, that address this by updating how the Swift compiler references explicitly-built Swift modules in debug info.&lt;/p&gt;

&lt;p&gt;The majority of developers will automatically benefit from &lt;strong&gt;faster&lt;/strong&gt;, more &lt;strong&gt;reliable debugging&lt;/strong&gt; and &lt;strong&gt;smaller build products&lt;/strong&gt;, without any modifications to their SwiftPM or Xcode projects.&lt;/p&gt;

&lt;p&gt;For developers who &lt;strong&gt;maintain their own build systems&lt;/strong&gt; using, for example, Bazel, Buck, or CMake, &lt;strong&gt;some adjustments may be necessary&lt;/strong&gt; to take advantage of these changes.&lt;/p&gt;

&lt;p&gt;This article explains how the debugger uses Swift modules. Next, it describes how Swift 6.3 changes the way modules are tracked in debug info to solve several problems with the previous representation. Finally, it shows how to adjust build systems to take advantage of the new representation and eliminate some build steps that are no longer necessary.&lt;/p&gt;

&lt;h2 id=&quot;swift-modules-and-expression-evaluation&quot; class=&quot;header-with-anchor&quot;&gt;Swift modules and expression evaluation &lt;a title=&quot;Permalink for Swift modules and expression evaluation section&quot; href=&quot;#swift-modules-and-expression-evaluation&quot;&gt;
            &lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt; &lt;svg width=&quot;18px&quot; height=&quot;18px&quot; viewBox=&quot;0 0 14 14&quot; role=&quot;img&quot; focusable=&quot;false&quot; aria-hidden=&quot;true&quot; xmlns=&quot;http://www.w3.org/2000/svg&quot;&gt;&lt;path d=&quot;m 11.58824,9.823529 q 0,-0.294117 -0.20589,-0.499999 L 9.85294,7.794118 q -0.20588,-0.205883 -0.5,-0.205883 -0.30882,0 -0.52941,0.235295 0.0221,0.02206 0.13971,0.136029 0.11764,0.113971 0.15808,0.158088 0.0404,0.04412 0.1103,0.139706 0.0698,0.09559 0.0956,0.1875 0.0257,0.09191 0.0257,0.202206 0,0.294117 -0.20588,0.5 -0.20588,0.205882 -0.5,0.205882 -0.1103,0 -0.20221,-0.02573 Q 8.35293,9.301471 8.25733,9.231621 8.16173,9.161771 8.11763,9.121327 8.07353,9.080887 7.95954,8.963238 7.84557,8.845591 7.82351,8.823533 7.58086,9.051474 7.58086,9.360297 q 0,0.294118 0.20588,0.5 l 1.51471,1.522059 q 0.19853,0.19853 0.5,0.19853 0.29412,0 0.5,-0.191177 l 1.08088,-1.073529 q 0.20589,-0.205883 0.20589,-0.492648 z M 6.41912,4.639706 q 0,-0.294118 -0.20588,-0.5 L 4.69853,2.617647 q -0.20588,-0.205882 -0.5,-0.205882 -0.28677,0 -0.5,0.198529 L 2.61765,3.683823 q -0.20589,0.205883 -0.20589,0.492648 0,0.294117 0.20589,0.499999 l 1.52941,1.529412 q 0.19853,0.19853 0.5,0.19853 0.30882,0 0.52941,-0.227942 Q 5.15437,6.15441 5.03676,6.040441 4.91912,5.92647 4.87868,5.882353 4.83828,5.838233 4.76838,5.742647 q -0.0698,-0.09559 -0.0956,-0.1875 -0.0257,-0.09191 -0.0257,-0.202206 0,-0.294117 0.20588,-0.5 0.20588,-0.205882 0.5,-0.205882 0.1103,0 0.20221,0.02573 0.0919,0.02573 0.1875,0.09559 0.0956,0.06985 0.1397,0.110294 0.0441,0.04044 0.15809,0.158089 Q 6.15443,5.154409 6.17649,5.176467 6.41914,4.948526 6.41914,4.639703 z M 13,9.823529 q 0,0.882353 -0.625,1.492647 l -1.08088,1.07353 Q 10.68382,13 9.80147,13 q -0.88971,0 -1.5,-0.625 L 6.78676,10.852941 Q 6.17647,10.242647 6.17647,9.360294 q 0,-0.904412 0.64706,-1.536764 L 6.17647,7.176471 Q 5.54412,7.82353 4.64706,7.82353 q -0.88235,0 -1.5,-0.617648 L 1.617647,5.676471 Q 1,5.058824 1,4.176471 1,3.294118 1.625,2.683824 L 2.70588,1.610294 Q 3.31618,1 4.19853,1 q 0.88971,0 1.5,0.625 l 1.51471,1.522059 q 0.61029,0.610294 0.61029,1.492647 0,0.904412 -0.64706,1.536764 L 7.82353,6.823529 Q 8.45588,6.17647 9.35294,6.17647 q 0.88235,0 1.5,0.617648 l 1.52941,1.529411 Q 13,8.941176 13,9.823529 z&quot;/&gt;&lt;/svg&gt;
          &lt;/a&gt;&lt;/h2&gt;

&lt;p&gt;LLDB’s standout feature is its &lt;a href=&quot;https://lldb.llvm.org/#compiler-integration-benefits&quot;&gt;powerful expression evaluator&lt;/a&gt;. Because LLDB embeds the Clang and Swift compilers, it can JIT-compile any valid source code and run it in the context of your application while stopped at a breakpoint. This includes not just calling code in your application, but also defining new data types, functions, and closures. Debugging features that are usually reserved for interpreted or JIT-compiled languages like JavaScript become available to ahead-of-time-compiled languages like C++ and, of course, Swift!&lt;/p&gt;

&lt;p&gt;In order to JIT-compile user expressions that make use of data types defined in the debugged program, LLDB’s embedded Swift compiler needs to import the Swift modules defining those types. In a world before explicitly-built modules, LLDB would find the base name of the main module at the current breakpoint in the debug info and then kick off an implicit import of a module with that name. With a cold module cache this would launch an expensive compilation of that module and all its dependencies.&lt;/p&gt;

&lt;p&gt;To illustrate this, let’s walk through a simple example:&lt;/p&gt;

&lt;div class=&quot;language-swift highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;lldb&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;p&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;myObj&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Here &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;myObj&lt;/code&gt; is just a local variable: LLDB can find its location in the debug info and resolve its type via reflection metadata. No need to bother the Swift compiler.
Let’s make it more complex:&lt;/p&gt;

&lt;div class=&quot;language-swift highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;lldb&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;p&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;myObj&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;myComputedProperty&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;In this case, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;myComputedProperty&lt;/code&gt; is really a function call; in order to evaluate this, LLDB needs the expression evaluator to run code in the target. In order to initialize a Swift compiler instance with the state of the current module, LLDB finds the name of the current function’s Swift module in debug info.
We can visualize what LLDB does using the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;dwarfdump&lt;/code&gt; utility:&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;dwarfdump Foo.o
...
DW_TAG_module
  DW_AT_name &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;Foo&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Conceptually, LLDB then wraps the expression in a function that can be compiled:&lt;/p&gt;

&lt;div class=&quot;language-swift highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;lldb&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;log&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;enable&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;lldb&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;expr&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;lldb&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;p&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;myObj&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;myComputedProperty&lt;/span&gt;
&lt;span class=&quot;o&quot;&gt;...&lt;/span&gt;
&lt;span class=&quot;kd&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;Foo&lt;/span&gt;

&lt;span class=&quot;kd&quot;&gt;func&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;lldb_expr&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;_&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;$__lldb_arg&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;UnsafeMutablePointer&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;Any&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
  &lt;span class=&quot;k&quot;&gt;let&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;myObj&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;MyObject&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;cm&quot;&gt;/* some LLDB magic */&lt;/span&gt;
  &lt;span class=&quot;c1&quot;&gt;// Expression begins here:&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;myObj&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;myComputedProperty&lt;/span&gt;
  &lt;span class=&quot;o&quot;&gt;...&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;One problem with this is that &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;import Foo&lt;/code&gt; is quite imprecise: Even though the Swift language doesn’t allow multiple modules to have the same name, even the most stringently engineered application may have more than one copy of the same module. For example, there might be a private version of a module containing all of its private declarations (which would be great for LLDB) and also a Swift interface file that only contains the public interface for the module. Or there might be &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;macOS&lt;/code&gt; and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Mac Catalyst&lt;/code&gt; variants of the same module in the same process.&lt;/p&gt;

&lt;h2 id=&quot;swift-modules-debug-info-and-the-build-system&quot; class=&quot;header-with-anchor&quot;&gt;Swift modules, debug info, and the build system &lt;a title=&quot;Permalink for Swift modules, debug info, and the build system section&quot; href=&quot;#swift-modules-debug-info-and-the-build-system&quot;&gt;
            &lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt; &lt;svg width=&quot;18px&quot; height=&quot;18px&quot; viewBox=&quot;0 0 14 14&quot; role=&quot;img&quot; focusable=&quot;false&quot; aria-hidden=&quot;true&quot; xmlns=&quot;http://www.w3.org/2000/svg&quot;&gt;&lt;path d=&quot;m 11.58824,9.823529 q 0,-0.294117 -0.20589,-0.499999 L 9.85294,7.794118 q -0.20588,-0.205883 -0.5,-0.205883 -0.30882,0 -0.52941,0.235295 0.0221,0.02206 0.13971,0.136029 0.11764,0.113971 0.15808,0.158088 0.0404,0.04412 0.1103,0.139706 0.0698,0.09559 0.0956,0.1875 0.0257,0.09191 0.0257,0.202206 0,0.294117 -0.20588,0.5 -0.20588,0.205882 -0.5,0.205882 -0.1103,0 -0.20221,-0.02573 Q 8.35293,9.301471 8.25733,9.231621 8.16173,9.161771 8.11763,9.121327 8.07353,9.080887 7.95954,8.963238 7.84557,8.845591 7.82351,8.823533 7.58086,9.051474 7.58086,9.360297 q 0,0.294118 0.20588,0.5 l 1.51471,1.522059 q 0.19853,0.19853 0.5,0.19853 0.29412,0 0.5,-0.191177 l 1.08088,-1.073529 q 0.20589,-0.205883 0.20589,-0.492648 z M 6.41912,4.639706 q 0,-0.294118 -0.20588,-0.5 L 4.69853,2.617647 q -0.20588,-0.205882 -0.5,-0.205882 -0.28677,0 -0.5,0.198529 L 2.61765,3.683823 q -0.20589,0.205883 -0.20589,0.492648 0,0.294117 0.20589,0.499999 l 1.52941,1.529412 q 0.19853,0.19853 0.5,0.19853 0.30882,0 0.52941,-0.227942 Q 5.15437,6.15441 5.03676,6.040441 4.91912,5.92647 4.87868,5.882353 4.83828,5.838233 4.76838,5.742647 q -0.0698,-0.09559 -0.0956,-0.1875 -0.0257,-0.09191 -0.0257,-0.202206 0,-0.294117 0.20588,-0.5 0.20588,-0.205882 0.5,-0.205882 0.1103,0 0.20221,0.02573 0.0919,0.02573 0.1875,0.09559 0.0956,0.06985 0.1397,0.110294 0.0441,0.04044 0.15809,0.158089 Q 6.15443,5.154409 6.17649,5.176467 6.41914,4.948526 6.41914,4.639703 z M 13,9.823529 q 0,0.882353 -0.625,1.492647 l -1.08088,1.07353 Q 10.68382,13 9.80147,13 q -0.88971,0 -1.5,-0.625 L 6.78676,10.852941 Q 6.17647,10.242647 6.17647,9.360294 q 0,-0.904412 0.64706,-1.536764 L 6.17647,7.176471 Q 5.54412,7.82353 4.64706,7.82353 q -0.88235,0 -1.5,-0.617648 L 1.617647,5.676471 Q 1,5.058824 1,4.176471 1,3.294118 1.625,2.683824 L 2.70588,1.610294 Q 3.31618,1 4.19853,1 q 0.88971,0 1.5,0.625 l 1.51471,1.522059 q 0.61029,0.610294 0.61029,1.492647 0,0.904412 -0.64706,1.536764 L 7.82353,6.823529 Q 8.45588,6.17647 9.35294,6.17647 q 0.88235,0 1.5,0.617648 l 1.52941,1.529411 Q 13,8.941176 13,9.823529 z&quot;/&gt;&lt;/svg&gt;
          &lt;/a&gt;&lt;/h2&gt;

&lt;p&gt;Let’s look at where those modules are found next. In order to communicate the location of &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Foo.swiftmodule&lt;/code&gt; to LLDB, Swift build systems rely on some cooperation from the linker. On Darwin the system linker accepts an option called &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;-add_ast_path&lt;/code&gt; and build systems are expected to specify this option to list every binary Swift module when linking.&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;c&quot;&gt;# Linker invocation on macOS&lt;/span&gt;
ld &lt;span class=&quot;nt&quot;&gt;-add_ast_path&lt;/span&gt; /path/to/Foo.swiftmodule Foo.o &lt;span class=&quot;nt&quot;&gt;-o&lt;/span&gt; MyApplication
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;The linker translates these options into symbol table entries. The debug info linker &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;dsymutil&lt;/code&gt; then collects all Swift modules and stores them in a special &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;__swift_ast&lt;/code&gt; section in the dSYM bundle, where LLDB can find them by name. Alternatively, when debugging without dSYM bundles, LLDB reads the symbol table entries in the binary to collect a list of all binary Swift modules.
Such an approach would not work on platforms where the linker isn’t aware of Swift. For these platforms, which include Windows, Linux, and FreeBSD, the Swift compiler provides a &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;-modulewrap&lt;/code&gt; action that takes a binary Swift module and outputs an object file with a &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;.swift_ast&lt;/code&gt; section holding the contents of the module. This object file can then be passed to any linker to get added to the binary, where LLDB can find it.&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;c&quot;&gt;# Modulewrap and linker invocation on Linux&lt;/span&gt;
swift-frontend &lt;span class=&quot;nt&quot;&gt;-modulewrap&lt;/span&gt; Foo.swiftmodule &lt;span class=&quot;nt&quot;&gt;-o&lt;/span&gt; Foo.swiftmodule.o
lld Foo.o Foo.swiftmodule.o &lt;span class=&quot;nt&quot;&gt;-o&lt;/span&gt; MyApplication
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;This can create scalability issues, especially for large applications:&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;Module files can get large and for an entire application you can often end up with a large portion of the SDK in the resulting binary. That can be quite problematic for the binary size.&lt;/li&gt;
  &lt;li&gt;As mentioned above, the chances of LLDB finding the right module in a Swift AST section or symbol table just by its base name diminish as the application gets more complex.&lt;/li&gt;
  &lt;li&gt;Binary Swift modules are version-locked to the precise compiler that created them. This is at odds with the intent of dSYM bundles, which are meant for long-term archival serialization of debug info.&lt;/li&gt;
  &lt;li&gt;If a matching explicit module cannot be found, LLDB falls back to an implicit module import which may involve recompiling parts of the SDK from source. This can be very slow.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;precise-module-tracking&quot; class=&quot;header-with-anchor&quot;&gt;Precise module tracking &lt;a title=&quot;Permalink for Precise module tracking section&quot; href=&quot;#precise-module-tracking&quot;&gt;
            &lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt; &lt;svg width=&quot;18px&quot; height=&quot;18px&quot; viewBox=&quot;0 0 14 14&quot; role=&quot;img&quot; focusable=&quot;false&quot; aria-hidden=&quot;true&quot; xmlns=&quot;http://www.w3.org/2000/svg&quot;&gt;&lt;path d=&quot;m 11.58824,9.823529 q 0,-0.294117 -0.20589,-0.499999 L 9.85294,7.794118 q -0.20588,-0.205883 -0.5,-0.205883 -0.30882,0 -0.52941,0.235295 0.0221,0.02206 0.13971,0.136029 0.11764,0.113971 0.15808,0.158088 0.0404,0.04412 0.1103,0.139706 0.0698,0.09559 0.0956,0.1875 0.0257,0.09191 0.0257,0.202206 0,0.294117 -0.20588,0.5 -0.20588,0.205882 -0.5,0.205882 -0.1103,0 -0.20221,-0.02573 Q 8.35293,9.301471 8.25733,9.231621 8.16173,9.161771 8.11763,9.121327 8.07353,9.080887 7.95954,8.963238 7.84557,8.845591 7.82351,8.823533 7.58086,9.051474 7.58086,9.360297 q 0,0.294118 0.20588,0.5 l 1.51471,1.522059 q 0.19853,0.19853 0.5,0.19853 0.29412,0 0.5,-0.191177 l 1.08088,-1.073529 q 0.20589,-0.205883 0.20589,-0.492648 z M 6.41912,4.639706 q 0,-0.294118 -0.20588,-0.5 L 4.69853,2.617647 q -0.20588,-0.205882 -0.5,-0.205882 -0.28677,0 -0.5,0.198529 L 2.61765,3.683823 q -0.20589,0.205883 -0.20589,0.492648 0,0.294117 0.20589,0.499999 l 1.52941,1.529412 q 0.19853,0.19853 0.5,0.19853 0.30882,0 0.52941,-0.227942 Q 5.15437,6.15441 5.03676,6.040441 4.91912,5.92647 4.87868,5.882353 4.83828,5.838233 4.76838,5.742647 q -0.0698,-0.09559 -0.0956,-0.1875 -0.0257,-0.09191 -0.0257,-0.202206 0,-0.294117 0.20588,-0.5 0.20588,-0.205882 0.5,-0.205882 0.1103,0 0.20221,0.02573 0.0919,0.02573 0.1875,0.09559 0.0956,0.06985 0.1397,0.110294 0.0441,0.04044 0.15809,0.158089 Q 6.15443,5.154409 6.17649,5.176467 6.41914,4.948526 6.41914,4.639703 z M 13,9.823529 q 0,0.882353 -0.625,1.492647 l -1.08088,1.07353 Q 10.68382,13 9.80147,13 q -0.88971,0 -1.5,-0.625 L 6.78676,10.852941 Q 6.17647,10.242647 6.17647,9.360294 q 0,-0.904412 0.64706,-1.536764 L 6.17647,7.176471 Q 5.54412,7.82353 4.64706,7.82353 q -0.88235,0 -1.5,-0.617648 L 1.617647,5.676471 Q 1,5.058824 1,4.176471 1,3.294118 1.625,2.683824 L 2.70588,1.610294 Q 3.31618,1 4.19853,1 q 0.88971,0 1.5,0.625 l 1.51471,1.522059 q 0.61029,0.610294 0.61029,1.492647 0,0.904412 -0.64706,1.536764 L 7.82353,6.823529 Q 8.45588,6.17647 9.35294,6.17647 q 0.88235,0 1.5,0.617648 l 1.52941,1.529411 Q 13,8.941176 13,9.823529 z&quot;/&gt;&lt;/svg&gt;
          &lt;/a&gt;&lt;/h2&gt;

&lt;p&gt;To evaluate expressions, the debugger needs to be able to find and import Swift modules. Until now, this relied either on special linker support or additional compilation steps, with a high cost for binary size. On top of that the debugger was imprecisely locating Swift modules by name.&lt;/p&gt;

&lt;p&gt;Starting in Swift 6.3 and continuing since, we have been making changes to the Swift compiler, the Swift driver, and LLDB that improve performance, reliability, and scalability. These changes are built on top of explicitly-built modules.&lt;/p&gt;

&lt;h3 id=&quot;whats-new&quot; class=&quot;header-with-anchor&quot;&gt;What’s new &lt;a title=&quot;Permalink for What’s new section&quot; href=&quot;#whats-new&quot;&gt;
            &lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt; &lt;svg width=&quot;18px&quot; height=&quot;18px&quot; viewBox=&quot;0 0 14 14&quot; role=&quot;img&quot; focusable=&quot;false&quot; aria-hidden=&quot;true&quot; xmlns=&quot;http://www.w3.org/2000/svg&quot;&gt;&lt;path d=&quot;m 11.58824,9.823529 q 0,-0.294117 -0.20589,-0.499999 L 9.85294,7.794118 q -0.20588,-0.205883 -0.5,-0.205883 -0.30882,0 -0.52941,0.235295 0.0221,0.02206 0.13971,0.136029 0.11764,0.113971 0.15808,0.158088 0.0404,0.04412 0.1103,0.139706 0.0698,0.09559 0.0956,0.1875 0.0257,0.09191 0.0257,0.202206 0,0.294117 -0.20588,0.5 -0.20588,0.205882 -0.5,0.205882 -0.1103,0 -0.20221,-0.02573 Q 8.35293,9.301471 8.25733,9.231621 8.16173,9.161771 8.11763,9.121327 8.07353,9.080887 7.95954,8.963238 7.84557,8.845591 7.82351,8.823533 7.58086,9.051474 7.58086,9.360297 q 0,0.294118 0.20588,0.5 l 1.51471,1.522059 q 0.19853,0.19853 0.5,0.19853 0.29412,0 0.5,-0.191177 l 1.08088,-1.073529 q 0.20589,-0.205883 0.20589,-0.492648 z M 6.41912,4.639706 q 0,-0.294118 -0.20588,-0.5 L 4.69853,2.617647 q -0.20588,-0.205882 -0.5,-0.205882 -0.28677,0 -0.5,0.198529 L 2.61765,3.683823 q -0.20589,0.205883 -0.20589,0.492648 0,0.294117 0.20589,0.499999 l 1.52941,1.529412 q 0.19853,0.19853 0.5,0.19853 0.30882,0 0.52941,-0.227942 Q 5.15437,6.15441 5.03676,6.040441 4.91912,5.92647 4.87868,5.882353 4.83828,5.838233 4.76838,5.742647 q -0.0698,-0.09559 -0.0956,-0.1875 -0.0257,-0.09191 -0.0257,-0.202206 0,-0.294117 0.20588,-0.5 0.20588,-0.205882 0.5,-0.205882 0.1103,0 0.20221,0.02573 0.0919,0.02573 0.1875,0.09559 0.0956,0.06985 0.1397,0.110294 0.0441,0.04044 0.15809,0.158089 Q 6.15443,5.154409 6.17649,5.176467 6.41914,4.948526 6.41914,4.639703 z M 13,9.823529 q 0,0.882353 -0.625,1.492647 l -1.08088,1.07353 Q 10.68382,13 9.80147,13 q -0.88971,0 -1.5,-0.625 L 6.78676,10.852941 Q 6.17647,10.242647 6.17647,9.360294 q 0,-0.904412 0.64706,-1.536764 L 6.17647,7.176471 Q 5.54412,7.82353 4.64706,7.82353 q -0.88235,0 -1.5,-0.617648 L 1.617647,5.676471 Q 1,5.058824 1,4.176471 1,3.294118 1.625,2.683824 L 2.70588,1.610294 Q 3.31618,1 4.19853,1 q 0.88971,0 1.5,0.625 l 1.51471,1.522059 q 0.61029,0.610294 0.61029,1.492647 0,0.904412 -0.64706,1.536764 L 7.82353,6.823529 Q 8.45588,6.17647 9.35294,6.17647 q 0.88235,0 1.5,0.617648 l 1.52941,1.529411 Q 13,8.941176 13,9.823529 z&quot;/&gt;&lt;/svg&gt;
          &lt;/a&gt;&lt;/h3&gt;

&lt;ul&gt;
  &lt;li&gt;
    &lt;p&gt;&lt;strong&gt;Explicitly-built modules track their explicit Swift dependencies:&lt;/strong&gt; Explicitly-built binary Swift modules have always kept track of their explicitly-built &lt;em&gt;Clang&lt;/em&gt; module dependencies. This is why LLDB can import explicit modules so much faster than implicit modules, which may need to recompile their dependencies from source. In Swift 6.3, explicitly-built binary Swift modules also keep track of their &lt;em&gt;Swift&lt;/em&gt; module dependencies. This makes importing an explicitly-built module fast and unambiguous because no module needs to be looked up by name. This happens automatically. Users don’t need to make any changes. Users with distributed build systems will already be familiar with the Swift frontend’s path remapping options, which now also affect Swift module paths.&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;&lt;strong&gt;Debug info stores path of object file’s own Swift module:&lt;/strong&gt; Once LLDB finds the top-level module it can precisely import it and all of its dependencies. But how can LLDB find precisely the module that belongs to the Swift file at the current breakpoint? In Swift 6.3, the Swift compiler can store the path to it in the debug info. Because a Swift file’s own Swift module is not an input to an object file compilation, there is a new &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;-debug-module-path&lt;/code&gt; compiler option to communicate the path to each object file compilation action. This path is also subject to the standard path remapping options used by users with distributed build systems.&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;&lt;strong&gt;Swift driver passes module path to compile jobs:&lt;/strong&gt; Users of &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;swiftpm&lt;/code&gt; or Xcode do not need to think about this, because the Swift driver also knows about the new &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;-debug-module-path&lt;/code&gt; option and automatically passes the path to the object file’s own Swift module to the compiler. However, users maintaining their own third-party build system to orchestrate Swift compilations with explicitly-built modules that are calling the Swift frontend directly and bypassing the Swift driver need to make sure to communicate the path to the top-level module to each object file compilation job.&lt;/p&gt;
  &lt;/li&gt;
&lt;/ul&gt;

&lt;h3 id=&quot;whats-deprecated&quot; class=&quot;header-with-anchor&quot;&gt;What’s deprecated &lt;a title=&quot;Permalink for What’s deprecated section&quot; href=&quot;#whats-deprecated&quot;&gt;
            &lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt; &lt;svg width=&quot;18px&quot; height=&quot;18px&quot; viewBox=&quot;0 0 14 14&quot; role=&quot;img&quot; focusable=&quot;false&quot; aria-hidden=&quot;true&quot; xmlns=&quot;http://www.w3.org/2000/svg&quot;&gt;&lt;path d=&quot;m 11.58824,9.823529 q 0,-0.294117 -0.20589,-0.499999 L 9.85294,7.794118 q -0.20588,-0.205883 -0.5,-0.205883 -0.30882,0 -0.52941,0.235295 0.0221,0.02206 0.13971,0.136029 0.11764,0.113971 0.15808,0.158088 0.0404,0.04412 0.1103,0.139706 0.0698,0.09559 0.0956,0.1875 0.0257,0.09191 0.0257,0.202206 0,0.294117 -0.20588,0.5 -0.20588,0.205882 -0.5,0.205882 -0.1103,0 -0.20221,-0.02573 Q 8.35293,9.301471 8.25733,9.231621 8.16173,9.161771 8.11763,9.121327 8.07353,9.080887 7.95954,8.963238 7.84557,8.845591 7.82351,8.823533 7.58086,9.051474 7.58086,9.360297 q 0,0.294118 0.20588,0.5 l 1.51471,1.522059 q 0.19853,0.19853 0.5,0.19853 0.29412,0 0.5,-0.191177 l 1.08088,-1.073529 q 0.20589,-0.205883 0.20589,-0.492648 z M 6.41912,4.639706 q 0,-0.294118 -0.20588,-0.5 L 4.69853,2.617647 q -0.20588,-0.205882 -0.5,-0.205882 -0.28677,0 -0.5,0.198529 L 2.61765,3.683823 q -0.20589,0.205883 -0.20589,0.492648 0,0.294117 0.20589,0.499999 l 1.52941,1.529412 q 0.19853,0.19853 0.5,0.19853 0.30882,0 0.52941,-0.227942 Q 5.15437,6.15441 5.03676,6.040441 4.91912,5.92647 4.87868,5.882353 4.83828,5.838233 4.76838,5.742647 q -0.0698,-0.09559 -0.0956,-0.1875 -0.0257,-0.09191 -0.0257,-0.202206 0,-0.294117 0.20588,-0.5 0.20588,-0.205882 0.5,-0.205882 0.1103,0 0.20221,0.02573 0.0919,0.02573 0.1875,0.09559 0.0956,0.06985 0.1397,0.110294 0.0441,0.04044 0.15809,0.158089 Q 6.15443,5.154409 6.17649,5.176467 6.41914,4.948526 6.41914,4.639703 z M 13,9.823529 q 0,0.882353 -0.625,1.492647 l -1.08088,1.07353 Q 10.68382,13 9.80147,13 q -0.88971,0 -1.5,-0.625 L 6.78676,10.852941 Q 6.17647,10.242647 6.17647,9.360294 q 0,-0.904412 0.64706,-1.536764 L 6.17647,7.176471 Q 5.54412,7.82353 4.64706,7.82353 q -0.88235,0 -1.5,-0.617648 L 1.617647,5.676471 Q 1,5.058824 1,4.176471 1,3.294118 1.625,2.683824 L 2.70588,1.610294 Q 3.31618,1 4.19853,1 q 0.88971,0 1.5,0.625 l 1.51471,1.522059 q 0.61029,0.610294 0.61029,1.492647 0,0.904412 -0.64706,1.536764 L 7.82353,6.823529 Q 8.45588,6.17647 9.35294,6.17647 q 0.88235,0 1.5,0.617648 l 1.52941,1.529411 Q 13,8.941176 13,9.823529 z&quot;/&gt;&lt;/svg&gt;
          &lt;/a&gt;&lt;/h3&gt;

&lt;p&gt;&lt;em&gt;Beginning in Swift 6.4, you can safely make the following changes.&lt;/em&gt;&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;
    &lt;p&gt;&lt;strong&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;swiftc -modulewrap&lt;/code&gt; and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;ld -add_ast_path&lt;/code&gt;:&lt;/strong&gt; Because the module paths are now communicated via debug info and the module headers themselves, third-party build systems doing explicit module builds can now remove all &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;-modulewrap&lt;/code&gt; actions on Linux and Windows; and remove the use of the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;-add_ast_path&lt;/code&gt; linker option on Darwin (macOS, iOS, &lt;em&gt;etc…&lt;/em&gt;).&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;&lt;strong&gt;Binary Swift modules in dSYM bundles:&lt;/strong&gt; As a consequence, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;dsymutil&lt;/code&gt; will no longer process binary Swift modules. This is a good thing, because binary Swift modules—which can only be parsed by the exact toolchain that produced them—were always at odds with dSYM bundles being a long-term archival format. Moreover, Swift modules often depend on Clang modules, and these Clang modules also were never included in dSYM bundles. By removing the binary Swift modules, dSYM bundles will get smaller.&lt;/p&gt;

    &lt;ul&gt;
      &lt;li&gt;&lt;em&gt;But don’t we need them for debugging?&lt;/em&gt; Since Swift 1.0, binary Swift modules were included in dSYM bundles because they were needed to resolve the types of local variables. However, starting with Swift 5.6, LLDB could perform this operation by reading the reflection metadata in the binary. The absence of binary Swift modules in dSYM bundles does not affect LLDB’s ability to inspect the contents of variables or dump object descriptions with &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;po&lt;/code&gt;. Binary Swift modules are still needed to evaluate complex expressions like function calls or computed getters. Expression evaluation continues to work as long as LLDB finds all binary modules in their original (or &lt;a href=&quot;https://lldb.llvm.org/use/map.html#remap-source-file-pathnames-for-the-debug-session&quot;&gt;remapped&lt;/a&gt;) location. This is always the case when debugging a just-built binary on the same machine. If the absence of binary Swift modules in dSYM bundles creates an unforeseen problem with your workflow, please let us know, either on the &lt;a href=&quot;https://forums.swift.org/c/development/lldb/13&quot;&gt;Swift LLDB forum&lt;/a&gt; or by creating an issue on the &lt;a href=&quot;https://github.com/swiftlang/swift/issues&quot;&gt;bug tracker&lt;/a&gt;.&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;When compiling with caching enabled, all paths pointing to Swift modules and module debug info are content-addressable storage references, identified by content rather than file location, so everything described here also works transparently with compilation caching.&lt;/p&gt;

&lt;h3 id=&quot;coming-in-swift-64-faster-bridging-header-import-in-lldb&quot; class=&quot;header-with-anchor&quot;&gt;Coming in Swift 6.4: Faster bridging header import in LLDB &lt;a title=&quot;Permalink for Coming in Swift 6.4: Faster bridging header import in LLDB section&quot; href=&quot;#coming-in-swift-64-faster-bridging-header-import-in-lldb&quot;&gt;
            &lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt; &lt;svg width=&quot;18px&quot; height=&quot;18px&quot; viewBox=&quot;0 0 14 14&quot; role=&quot;img&quot; focusable=&quot;false&quot; aria-hidden=&quot;true&quot; xmlns=&quot;http://www.w3.org/2000/svg&quot;&gt;&lt;path d=&quot;m 11.58824,9.823529 q 0,-0.294117 -0.20589,-0.499999 L 9.85294,7.794118 q -0.20588,-0.205883 -0.5,-0.205883 -0.30882,0 -0.52941,0.235295 0.0221,0.02206 0.13971,0.136029 0.11764,0.113971 0.15808,0.158088 0.0404,0.04412 0.1103,0.139706 0.0698,0.09559 0.0956,0.1875 0.0257,0.09191 0.0257,0.202206 0,0.294117 -0.20588,0.5 -0.20588,0.205882 -0.5,0.205882 -0.1103,0 -0.20221,-0.02573 Q 8.35293,9.301471 8.25733,9.231621 8.16173,9.161771 8.11763,9.121327 8.07353,9.080887 7.95954,8.963238 7.84557,8.845591 7.82351,8.823533 7.58086,9.051474 7.58086,9.360297 q 0,0.294118 0.20588,0.5 l 1.51471,1.522059 q 0.19853,0.19853 0.5,0.19853 0.29412,0 0.5,-0.191177 l 1.08088,-1.073529 q 0.20589,-0.205883 0.20589,-0.492648 z M 6.41912,4.639706 q 0,-0.294118 -0.20588,-0.5 L 4.69853,2.617647 q -0.20588,-0.205882 -0.5,-0.205882 -0.28677,0 -0.5,0.198529 L 2.61765,3.683823 q -0.20589,0.205883 -0.20589,0.492648 0,0.294117 0.20589,0.499999 l 1.52941,1.529412 q 0.19853,0.19853 0.5,0.19853 0.30882,0 0.52941,-0.227942 Q 5.15437,6.15441 5.03676,6.040441 4.91912,5.92647 4.87868,5.882353 4.83828,5.838233 4.76838,5.742647 q -0.0698,-0.09559 -0.0956,-0.1875 -0.0257,-0.09191 -0.0257,-0.202206 0,-0.294117 0.20588,-0.5 0.20588,-0.205882 0.5,-0.205882 0.1103,0 0.20221,0.02573 0.0919,0.02573 0.1875,0.09559 0.0956,0.06985 0.1397,0.110294 0.0441,0.04044 0.15809,0.158089 Q 6.15443,5.154409 6.17649,5.176467 6.41914,4.948526 6.41914,4.639703 z M 13,9.823529 q 0,0.882353 -0.625,1.492647 l -1.08088,1.07353 Q 10.68382,13 9.80147,13 q -0.88971,0 -1.5,-0.625 L 6.78676,10.852941 Q 6.17647,10.242647 6.17647,9.360294 q 0,-0.904412 0.64706,-1.536764 L 6.17647,7.176471 Q 5.54412,7.82353 4.64706,7.82353 q -0.88235,0 -1.5,-0.617648 L 1.617647,5.676471 Q 1,5.058824 1,4.176471 1,3.294118 1.625,2.683824 L 2.70588,1.610294 Q 3.31618,1 4.19853,1 q 0.88971,0 1.5,0.625 l 1.51471,1.522059 q 0.61029,0.610294 0.61029,1.492647 0,0.904412 -0.64706,1.536764 L 7.82353,6.823529 Q 8.45588,6.17647 9.35294,6.17647 q 0.88235,0 1.5,0.617648 l 1.52941,1.529411 Q 13,8.941176 13,9.823529 z&quot;/&gt;&lt;/svg&gt;
          &lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Beyond more reliable path tracking, Swift 6.4 will also speed up importing bridging headers, a step common enough across Swift projects that most developers will feel the difference.&lt;/p&gt;

&lt;p&gt;Up to and including Swift 6.3, LLDB always compiles a bridging header from source, a step that can add noticeable time to debugging sessions that use one. In recent nightly development toolchains, LLDB can use the new precise explicit module information to import precompiled bridging headers and their explicit module dependencies directly. This makes debugging explicitly-built projects with bridging headers as fast and reliable as debugging fully modularized projects.&lt;/p&gt;

&lt;h2 id=&quot;summary&quot; class=&quot;header-with-anchor&quot;&gt;Summary &lt;a title=&quot;Permalink for Summary section&quot; href=&quot;#summary&quot;&gt;
            &lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt; &lt;svg width=&quot;18px&quot; height=&quot;18px&quot; viewBox=&quot;0 0 14 14&quot; role=&quot;img&quot; focusable=&quot;false&quot; aria-hidden=&quot;true&quot; xmlns=&quot;http://www.w3.org/2000/svg&quot;&gt;&lt;path d=&quot;m 11.58824,9.823529 q 0,-0.294117 -0.20589,-0.499999 L 9.85294,7.794118 q -0.20588,-0.205883 -0.5,-0.205883 -0.30882,0 -0.52941,0.235295 0.0221,0.02206 0.13971,0.136029 0.11764,0.113971 0.15808,0.158088 0.0404,0.04412 0.1103,0.139706 0.0698,0.09559 0.0956,0.1875 0.0257,0.09191 0.0257,0.202206 0,0.294117 -0.20588,0.5 -0.20588,0.205882 -0.5,0.205882 -0.1103,0 -0.20221,-0.02573 Q 8.35293,9.301471 8.25733,9.231621 8.16173,9.161771 8.11763,9.121327 8.07353,9.080887 7.95954,8.963238 7.84557,8.845591 7.82351,8.823533 7.58086,9.051474 7.58086,9.360297 q 0,0.294118 0.20588,0.5 l 1.51471,1.522059 q 0.19853,0.19853 0.5,0.19853 0.29412,0 0.5,-0.191177 l 1.08088,-1.073529 q 0.20589,-0.205883 0.20589,-0.492648 z M 6.41912,4.639706 q 0,-0.294118 -0.20588,-0.5 L 4.69853,2.617647 q -0.20588,-0.205882 -0.5,-0.205882 -0.28677,0 -0.5,0.198529 L 2.61765,3.683823 q -0.20589,0.205883 -0.20589,0.492648 0,0.294117 0.20589,0.499999 l 1.52941,1.529412 q 0.19853,0.19853 0.5,0.19853 0.30882,0 0.52941,-0.227942 Q 5.15437,6.15441 5.03676,6.040441 4.91912,5.92647 4.87868,5.882353 4.83828,5.838233 4.76838,5.742647 q -0.0698,-0.09559 -0.0956,-0.1875 -0.0257,-0.09191 -0.0257,-0.202206 0,-0.294117 0.20588,-0.5 0.20588,-0.205882 0.5,-0.205882 0.1103,0 0.20221,0.02573 0.0919,0.02573 0.1875,0.09559 0.0956,0.06985 0.1397,0.110294 0.0441,0.04044 0.15809,0.158089 Q 6.15443,5.154409 6.17649,5.176467 6.41914,4.948526 6.41914,4.639703 z M 13,9.823529 q 0,0.882353 -0.625,1.492647 l -1.08088,1.07353 Q 10.68382,13 9.80147,13 q -0.88971,0 -1.5,-0.625 L 6.78676,10.852941 Q 6.17647,10.242647 6.17647,9.360294 q 0,-0.904412 0.64706,-1.536764 L 6.17647,7.176471 Q 5.54412,7.82353 4.64706,7.82353 q -0.88235,0 -1.5,-0.617648 L 1.617647,5.676471 Q 1,5.058824 1,4.176471 1,3.294118 1.625,2.683824 L 2.70588,1.610294 Q 3.31618,1 4.19853,1 q 0.88971,0 1.5,0.625 l 1.51471,1.522059 q 0.61029,0.610294 0.61029,1.492647 0,0.904412 -0.64706,1.536764 L 7.82353,6.823529 Q 8.45588,6.17647 9.35294,6.17647 q 0.88235,0 1.5,0.617648 l 1.52941,1.529411 Q 13,8.941176 13,9.823529 z&quot;/&gt;&lt;/svg&gt;
          &lt;/a&gt;&lt;/h2&gt;

&lt;p&gt;With these changes for &lt;strong&gt;explicitly-built modules&lt;/strong&gt;:&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;Binaries built with debug info on Windows and Linux, and dSYM bundles on Darwin will get dramatically smaller, since they no longer contain any binary Swift modules (6.4+)&lt;/li&gt;
  &lt;li&gt;Contextual module imports in LLDB become more reliable due to precise tracking instead of by-name lookups&lt;/li&gt;
  &lt;li&gt;Certain performance cliffs around module importing in LLDB are eliminated (such as SDK module dependencies in dSYMs triggering implicit imports)&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;Developers maintaining their own build systems&lt;/strong&gt; can remove support for &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;-modulewrap&lt;/code&gt; actions and remove &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;-add_ast_path&lt;/code&gt; from the linker flags, but may need to pass &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;-debug-module-path&lt;/code&gt; to the compiler if they are not letting the Swift driver handle the frontend options&lt;/li&gt;
  &lt;li&gt;Finally, static archives were easy to overlook: projects that didn’t use &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;-add_ast_path&lt;/code&gt; when linking them often had confusing debugging issues inside those archives as a result. This entire class of issues has been designed away.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;em&gt;tl;dr:&lt;/em&gt; &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;-modulewrap&lt;/code&gt; and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;-add_ast_path&lt;/code&gt; are replaced by &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;-debug-module-path&lt;/code&gt;. Debug info gets smaller and more precise.&lt;/p&gt;
</content>
  </entry>
  
  <entry>
    <title>What's new in Swift: August 2026 Edition</title>
    
      
        
        <author>
        
          <name>Simon Leeb</name>
        
        </author>
      
        
        <author>
        
          <name>Dave Lester</name>
        
        </author>
      
    
    <link href="https://swift.org/blog/whats-new-in-swift-august-2026/"/>
    <updated>2026-09-04T12:30:00-04:00</updated>
    <id>https://swift.org/blog/whats-new-in-swift-august-2026/</id>
    <content type="html">&lt;p&gt;Welcome to “What’s new in Swift,” a curated digest of releases, videos, and discussions in the Swift project and community.&lt;/p&gt;

&lt;p&gt;Here’s an update from guest contributor Simon Leeb on Swift’s progress as a language for web scenarios:&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;Hi, Simon here! I am the creator of the &lt;a href=&quot;https://github.com/elementary-swift&quot;&gt;elementary-swift&lt;/a&gt; project, a collection of packages born from a simple wish: I want to build web UIs in Swift and ultimately help Swift become a first-class choice for the web.&lt;/p&gt;

  &lt;p&gt;This journey began after I started using Swift for backend services. The web frontend, however, still lived in a separate ecosystem, and I really wanted it to feel as ergonomic, safe, and efficient as the Swift I was writing everywhere else.&lt;/p&gt;

  &lt;p&gt;That led to the creation of &lt;a href=&quot;https://github.com/elementary-swift/elementary&quot;&gt;Elementary&lt;/a&gt;: a modern and efficient HTML rendering library with a familiar declarative API, built for the web. It integrates easily with frameworks like Vapor and Hummingbird, and has become a practical option for server-rendered web UIs.&lt;/p&gt;

  &lt;p&gt;Around that same time, years of community work in the &lt;a href=&quot;https://swiftwasm.org/&quot;&gt;swift-wasm&lt;/a&gt; project made compiling Swift to WebAssembly increasingly viable, while Embedded Swift was taking its first experimental steps. This made me wonder: “How hard can it be to use Embedded Swift and build a state-driven web UI framework that produces tiny WebAssembly binaries?” Turns out: quite hard, actually!&lt;/p&gt;

  &lt;p&gt;But it was too late. Despite my better judgment, I was in the middle of creating what is now known as &lt;a href=&quot;https://elementary.codes/&quot;&gt;ElementaryUI&lt;/a&gt;. Where Elementary renders HTML on the server, ElementaryUI runs in the browser itself. You can watch my &lt;a href=&quot;https://www.youtube.com/watch?v=OmQ881sOTIc&quot;&gt;talk at Swift@FOSDEM 2026&lt;/a&gt; if you want to know more about the why, what, and how.&lt;/p&gt;

  &lt;p&gt;To showcase where the project is heading, I recently posted a small &lt;a href=&quot;https://forums.swift.org/t/edge-of-tomorrow-full-stack-swift-on-both-sides-of-fetch/89175&quot;&gt;Full-Stack Swift on Cloudflare demo&lt;/a&gt;. It features Swift in the browser communicating with a Swift backend on an edge worker through shared message types. I hope it gives people a concrete sense of how much the core technologies and the surrounding tooling have advanced.&lt;/p&gt;

  &lt;p&gt;ElementaryUI is still young, with plenty left to build. Visit &lt;a href=&quot;https://elementary.codes/&quot;&gt;elementary.codes&lt;/a&gt; to try it, share feedback, contribute, or sponsor its development. Let’s work together and make Swift a first-class choice for the web!&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Now on to other news about Swift:&lt;/p&gt;

&lt;h2 id=&quot;videos-to-watch&quot; class=&quot;header-with-anchor&quot;&gt;Videos to watch &lt;a title=&quot;Permalink for Videos to watch section&quot; href=&quot;#videos-to-watch&quot;&gt;
            &lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt; &lt;svg width=&quot;18px&quot; height=&quot;18px&quot; viewBox=&quot;0 0 14 14&quot; role=&quot;img&quot; focusable=&quot;false&quot; aria-hidden=&quot;true&quot; xmlns=&quot;http://www.w3.org/2000/svg&quot;&gt;&lt;path d=&quot;m 11.58824,9.823529 q 0,-0.294117 -0.20589,-0.499999 L 9.85294,7.794118 q -0.20588,-0.205883 -0.5,-0.205883 -0.30882,0 -0.52941,0.235295 0.0221,0.02206 0.13971,0.136029 0.11764,0.113971 0.15808,0.158088 0.0404,0.04412 0.1103,0.139706 0.0698,0.09559 0.0956,0.1875 0.0257,0.09191 0.0257,0.202206 0,0.294117 -0.20588,0.5 -0.20588,0.205882 -0.5,0.205882 -0.1103,0 -0.20221,-0.02573 Q 8.35293,9.301471 8.25733,9.231621 8.16173,9.161771 8.11763,9.121327 8.07353,9.080887 7.95954,8.963238 7.84557,8.845591 7.82351,8.823533 7.58086,9.051474 7.58086,9.360297 q 0,0.294118 0.20588,0.5 l 1.51471,1.522059 q 0.19853,0.19853 0.5,0.19853 0.29412,0 0.5,-0.191177 l 1.08088,-1.073529 q 0.20589,-0.205883 0.20589,-0.492648 z M 6.41912,4.639706 q 0,-0.294118 -0.20588,-0.5 L 4.69853,2.617647 q -0.20588,-0.205882 -0.5,-0.205882 -0.28677,0 -0.5,0.198529 L 2.61765,3.683823 q -0.20589,0.205883 -0.20589,0.492648 0,0.294117 0.20589,0.499999 l 1.52941,1.529412 q 0.19853,0.19853 0.5,0.19853 0.30882,0 0.52941,-0.227942 Q 5.15437,6.15441 5.03676,6.040441 4.91912,5.92647 4.87868,5.882353 4.83828,5.838233 4.76838,5.742647 q -0.0698,-0.09559 -0.0956,-0.1875 -0.0257,-0.09191 -0.0257,-0.202206 0,-0.294117 0.20588,-0.5 0.20588,-0.205882 0.5,-0.205882 0.1103,0 0.20221,0.02573 0.0919,0.02573 0.1875,0.09559 0.0956,0.06985 0.1397,0.110294 0.0441,0.04044 0.15809,0.158089 Q 6.15443,5.154409 6.17649,5.176467 6.41914,4.948526 6.41914,4.639703 z M 13,9.823529 q 0,0.882353 -0.625,1.492647 l -1.08088,1.07353 Q 10.68382,13 9.80147,13 q -0.88971,0 -1.5,-0.625 L 6.78676,10.852941 Q 6.17647,10.242647 6.17647,9.360294 q 0,-0.904412 0.64706,-1.536764 L 6.17647,7.176471 Q 5.54412,7.82353 4.64706,7.82353 q -0.88235,0 -1.5,-0.617648 L 1.617647,5.676471 Q 1,5.058824 1,4.176471 1,3.294118 1.625,2.683824 L 2.70588,1.610294 Q 3.31618,1 4.19853,1 q 0.88971,0 1.5,0.625 l 1.51471,1.522059 q 0.61029,0.610294 0.61029,1.492647 0,0.904412 -0.64706,1.536764 L 7.82353,6.823529 Q 8.45588,6.17647 9.35294,6.17647 q 0.88235,0 1.5,0.617648 l 1.52941,1.529411 Q 13,8.941176 13,9.823529 z&quot;/&gt;&lt;/svg&gt;
          &lt;/a&gt;&lt;/h2&gt;
&lt;ul&gt;
  &lt;li&gt;Saleem Abdulrasool joined the Empower Apps podcast to discuss &lt;a href=&quot;https://www.youtube.com/watch?v=ZIC-Q1B7FHM&quot;&gt;Swift on Windows&lt;/a&gt;, server-side Swift, SwiftWin32, Swift’s C++ interop, and how to get started.&lt;/li&gt;
  &lt;li&gt;Building memory-safe software? &lt;a href=&quot;https://www.youtube.com/watch?v=nBuUinlZuow&quot;&gt;Write security-sensitive code in Swift&lt;/a&gt; covers how Swift guarantees safety across bounds, lifetimes, types, initialization, and concurrency, with primitives like &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Span&lt;/code&gt; and non-copyable types, plus how to audit &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;unsafe&lt;/code&gt; code with strict memory safety and incrementally migrate existing C modules.&lt;/li&gt;
  &lt;li&gt;Two short videos about running Embedded Swift on Raspberry Pi Pico: a video on getting started on macOS called &lt;a href=&quot;https://www.youtube.com/watch?v=p2e_RPgMo5g&quot;&gt;Let it blink!&lt;/a&gt; and &lt;a href=&quot;https://www.youtube.com/watch?v=Ht_gejbvAHA&quot;&gt;Fun with traffic lights in 60 seconds&lt;/a&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;community-highlights&quot; class=&quot;header-with-anchor&quot;&gt;Community highlights &lt;a title=&quot;Permalink for Community highlights section&quot; href=&quot;#community-highlights&quot;&gt;
            &lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt; &lt;svg width=&quot;18px&quot; height=&quot;18px&quot; viewBox=&quot;0 0 14 14&quot; role=&quot;img&quot; focusable=&quot;false&quot; aria-hidden=&quot;true&quot; xmlns=&quot;http://www.w3.org/2000/svg&quot;&gt;&lt;path d=&quot;m 11.58824,9.823529 q 0,-0.294117 -0.20589,-0.499999 L 9.85294,7.794118 q -0.20588,-0.205883 -0.5,-0.205883 -0.30882,0 -0.52941,0.235295 0.0221,0.02206 0.13971,0.136029 0.11764,0.113971 0.15808,0.158088 0.0404,0.04412 0.1103,0.139706 0.0698,0.09559 0.0956,0.1875 0.0257,0.09191 0.0257,0.202206 0,0.294117 -0.20588,0.5 -0.20588,0.205882 -0.5,0.205882 -0.1103,0 -0.20221,-0.02573 Q 8.35293,9.301471 8.25733,9.231621 8.16173,9.161771 8.11763,9.121327 8.07353,9.080887 7.95954,8.963238 7.84557,8.845591 7.82351,8.823533 7.58086,9.051474 7.58086,9.360297 q 0,0.294118 0.20588,0.5 l 1.51471,1.522059 q 0.19853,0.19853 0.5,0.19853 0.29412,0 0.5,-0.191177 l 1.08088,-1.073529 q 0.20589,-0.205883 0.20589,-0.492648 z M 6.41912,4.639706 q 0,-0.294118 -0.20588,-0.5 L 4.69853,2.617647 q -0.20588,-0.205882 -0.5,-0.205882 -0.28677,0 -0.5,0.198529 L 2.61765,3.683823 q -0.20589,0.205883 -0.20589,0.492648 0,0.294117 0.20589,0.499999 l 1.52941,1.529412 q 0.19853,0.19853 0.5,0.19853 0.30882,0 0.52941,-0.227942 Q 5.15437,6.15441 5.03676,6.040441 4.91912,5.92647 4.87868,5.882353 4.83828,5.838233 4.76838,5.742647 q -0.0698,-0.09559 -0.0956,-0.1875 -0.0257,-0.09191 -0.0257,-0.202206 0,-0.294117 0.20588,-0.5 0.20588,-0.205882 0.5,-0.205882 0.1103,0 0.20221,0.02573 0.0919,0.02573 0.1875,0.09559 0.0956,0.06985 0.1397,0.110294 0.0441,0.04044 0.15809,0.158089 Q 6.15443,5.154409 6.17649,5.176467 6.41914,4.948526 6.41914,4.639703 z M 13,9.823529 q 0,0.882353 -0.625,1.492647 l -1.08088,1.07353 Q 10.68382,13 9.80147,13 q -0.88971,0 -1.5,-0.625 L 6.78676,10.852941 Q 6.17647,10.242647 6.17647,9.360294 q 0,-0.904412 0.64706,-1.536764 L 6.17647,7.176471 Q 5.54412,7.82353 4.64706,7.82353 q -0.88235,0 -1.5,-0.617648 L 1.617647,5.676471 Q 1,5.058824 1,4.176471 1,3.294118 1.625,2.683824 L 2.70588,1.610294 Q 3.31618,1 4.19853,1 q 0.88971,0 1.5,0.625 l 1.51471,1.522059 q 0.61029,0.610294 0.61029,1.492647 0,0.904412 -0.64706,1.536764 L 7.82353,6.823529 Q 8.45588,6.17647 9.35294,6.17647 q 0.88235,0 1.5,0.617648 l 1.52941,1.529411 Q 13,8.941176 13,9.823529 z&quot;/&gt;&lt;/svg&gt;
          &lt;/a&gt;&lt;/h2&gt;
&lt;ul&gt;
  &lt;li&gt;&lt;a href=&quot;https://theswiftdev.com/building-scalable-backend-apps-in-swift/&quot;&gt;Building scalable backend apps in Swift&lt;/a&gt; shares an approach to structuring server-side Swift codebases, separating business logic from database and framework details so the code stays easier to test and change over time.&lt;/li&gt;
  &lt;li&gt;The Swift Package Index blog explains &lt;a href=&quot;https://swiftpackageindex.com/blog/what-is-a-package-registry&quot;&gt;what a package registry actually is&lt;/a&gt;, how it fits alongside SwiftPM and package indexes, and walks through an example of switching a dependency managed from Git to a Swift registry.&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;/blog/embedded-swift-improvements-coming-in-swift-6.4/&quot;&gt;Embedded Swift Improvements Coming in Swift 6.4&lt;/a&gt; rounds up what’s ahead for Swift on microcontrollers and other constrained environments.&lt;/li&gt;
  &lt;li&gt;The Browser Company’s &lt;a href=&quot;https://speakinginswift.substack.com/p/swift-on-windows-a-year-of-refinement&quot;&gt;Swift on Windows: A year of refinement&lt;/a&gt; reflects on a year of work making Swift on Windows more predictable.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;new-package-releases&quot; class=&quot;header-with-anchor&quot;&gt;New package releases &lt;a title=&quot;Permalink for New package releases section&quot; href=&quot;#new-package-releases&quot;&gt;
            &lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt; &lt;svg width=&quot;18px&quot; height=&quot;18px&quot; viewBox=&quot;0 0 14 14&quot; role=&quot;img&quot; focusable=&quot;false&quot; aria-hidden=&quot;true&quot; xmlns=&quot;http://www.w3.org/2000/svg&quot;&gt;&lt;path d=&quot;m 11.58824,9.823529 q 0,-0.294117 -0.20589,-0.499999 L 9.85294,7.794118 q -0.20588,-0.205883 -0.5,-0.205883 -0.30882,0 -0.52941,0.235295 0.0221,0.02206 0.13971,0.136029 0.11764,0.113971 0.15808,0.158088 0.0404,0.04412 0.1103,0.139706 0.0698,0.09559 0.0956,0.1875 0.0257,0.09191 0.0257,0.202206 0,0.294117 -0.20588,0.5 -0.20588,0.205882 -0.5,0.205882 -0.1103,0 -0.20221,-0.02573 Q 8.35293,9.301471 8.25733,9.231621 8.16173,9.161771 8.11763,9.121327 8.07353,9.080887 7.95954,8.963238 7.84557,8.845591 7.82351,8.823533 7.58086,9.051474 7.58086,9.360297 q 0,0.294118 0.20588,0.5 l 1.51471,1.522059 q 0.19853,0.19853 0.5,0.19853 0.29412,0 0.5,-0.191177 l 1.08088,-1.073529 q 0.20589,-0.205883 0.20589,-0.492648 z M 6.41912,4.639706 q 0,-0.294118 -0.20588,-0.5 L 4.69853,2.617647 q -0.20588,-0.205882 -0.5,-0.205882 -0.28677,0 -0.5,0.198529 L 2.61765,3.683823 q -0.20589,0.205883 -0.20589,0.492648 0,0.294117 0.20589,0.499999 l 1.52941,1.529412 q 0.19853,0.19853 0.5,0.19853 0.30882,0 0.52941,-0.227942 Q 5.15437,6.15441 5.03676,6.040441 4.91912,5.92647 4.87868,5.882353 4.83828,5.838233 4.76838,5.742647 q -0.0698,-0.09559 -0.0956,-0.1875 -0.0257,-0.09191 -0.0257,-0.202206 0,-0.294117 0.20588,-0.5 0.20588,-0.205882 0.5,-0.205882 0.1103,0 0.20221,0.02573 0.0919,0.02573 0.1875,0.09559 0.0956,0.06985 0.1397,0.110294 0.0441,0.04044 0.15809,0.158089 Q 6.15443,5.154409 6.17649,5.176467 6.41914,4.948526 6.41914,4.639703 z M 13,9.823529 q 0,0.882353 -0.625,1.492647 l -1.08088,1.07353 Q 10.68382,13 9.80147,13 q -0.88971,0 -1.5,-0.625 L 6.78676,10.852941 Q 6.17647,10.242647 6.17647,9.360294 q 0,-0.904412 0.64706,-1.536764 L 6.17647,7.176471 Q 5.54412,7.82353 4.64706,7.82353 q -0.88235,0 -1.5,-0.617648 L 1.617647,5.676471 Q 1,5.058824 1,4.176471 1,3.294118 1.625,2.683824 L 2.70588,1.610294 Q 3.31618,1 4.19853,1 q 0.88971,0 1.5,0.625 l 1.51471,1.522059 q 0.61029,0.610294 0.61029,1.492647 0,0.904412 -0.64706,1.536764 L 7.82353,6.823529 Q 8.45588,6.17647 9.35294,6.17647 q 0.88235,0 1.5,0.617648 l 1.52941,1.529411 Q 13,8.941176 13,9.823529 z&quot;/&gt;&lt;/svg&gt;
          &lt;/a&gt;&lt;/h2&gt;
&lt;ul&gt;
  &lt;li&gt;Write an interface once with &lt;a href=&quot;https://swifttui.sh&quot;&gt;SwiftTUI&lt;/a&gt; using a declarative, state-driven syntax, then ship it as a terminal app, as a native macOS or iOS app, as an Android app, or as a WASI build for the browser.&lt;/li&gt;
  &lt;li&gt;Tired of hand-writing &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;RawRepresentable&lt;/code&gt; and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;LosslessStringConvertible&lt;/code&gt; conformances? &lt;a href=&quot;https://github.com/ordo-one/lexic&quot;&gt;lexic&lt;/a&gt; generates them for you via macros, and runs the same on Linux as on Apple platforms.&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://github.com/pointfreeco/swift-structured-queries&quot;&gt;StructuredQueries&lt;/a&gt;, Point-Free’s SQLite query builder, now has fully type-safe support for JSON and JSONB columns, including a &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;json_each&lt;/code&gt; table function, so nested data can be queried and updated by key path without leaving Swift’s type system.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;swift-evolution&quot; class=&quot;header-with-anchor&quot;&gt;Swift Evolution &lt;a title=&quot;Permalink for Swift Evolution section&quot; href=&quot;#swift-evolution&quot;&gt;
            &lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt; &lt;svg width=&quot;18px&quot; height=&quot;18px&quot; viewBox=&quot;0 0 14 14&quot; role=&quot;img&quot; focusable=&quot;false&quot; aria-hidden=&quot;true&quot; xmlns=&quot;http://www.w3.org/2000/svg&quot;&gt;&lt;path d=&quot;m 11.58824,9.823529 q 0,-0.294117 -0.20589,-0.499999 L 9.85294,7.794118 q -0.20588,-0.205883 -0.5,-0.205883 -0.30882,0 -0.52941,0.235295 0.0221,0.02206 0.13971,0.136029 0.11764,0.113971 0.15808,0.158088 0.0404,0.04412 0.1103,0.139706 0.0698,0.09559 0.0956,0.1875 0.0257,0.09191 0.0257,0.202206 0,0.294117 -0.20588,0.5 -0.20588,0.205882 -0.5,0.205882 -0.1103,0 -0.20221,-0.02573 Q 8.35293,9.301471 8.25733,9.231621 8.16173,9.161771 8.11763,9.121327 8.07353,9.080887 7.95954,8.963238 7.84557,8.845591 7.82351,8.823533 7.58086,9.051474 7.58086,9.360297 q 0,0.294118 0.20588,0.5 l 1.51471,1.522059 q 0.19853,0.19853 0.5,0.19853 0.29412,0 0.5,-0.191177 l 1.08088,-1.073529 q 0.20589,-0.205883 0.20589,-0.492648 z M 6.41912,4.639706 q 0,-0.294118 -0.20588,-0.5 L 4.69853,2.617647 q -0.20588,-0.205882 -0.5,-0.205882 -0.28677,0 -0.5,0.198529 L 2.61765,3.683823 q -0.20589,0.205883 -0.20589,0.492648 0,0.294117 0.20589,0.499999 l 1.52941,1.529412 q 0.19853,0.19853 0.5,0.19853 0.30882,0 0.52941,-0.227942 Q 5.15437,6.15441 5.03676,6.040441 4.91912,5.92647 4.87868,5.882353 4.83828,5.838233 4.76838,5.742647 q -0.0698,-0.09559 -0.0956,-0.1875 -0.0257,-0.09191 -0.0257,-0.202206 0,-0.294117 0.20588,-0.5 0.20588,-0.205882 0.5,-0.205882 0.1103,0 0.20221,0.02573 0.0919,0.02573 0.1875,0.09559 0.0956,0.06985 0.1397,0.110294 0.0441,0.04044 0.15809,0.158089 Q 6.15443,5.154409 6.17649,5.176467 6.41914,4.948526 6.41914,4.639703 z M 13,9.823529 q 0,0.882353 -0.625,1.492647 l -1.08088,1.07353 Q 10.68382,13 9.80147,13 q -0.88971,0 -1.5,-0.625 L 6.78676,10.852941 Q 6.17647,10.242647 6.17647,9.360294 q 0,-0.904412 0.64706,-1.536764 L 6.17647,7.176471 Q 5.54412,7.82353 4.64706,7.82353 q -0.88235,0 -1.5,-0.617648 L 1.617647,5.676471 Q 1,5.058824 1,4.176471 1,3.294118 1.625,2.683824 L 2.70588,1.610294 Q 3.31618,1 4.19853,1 q 0.88971,0 1.5,0.625 l 1.51471,1.522059 q 0.61029,0.610294 0.61029,1.492647 0,0.904412 -0.64706,1.536764 L 7.82353,6.823529 Q 8.45588,6.17647 9.35294,6.17647 q 0.88235,0 1.5,0.617648 l 1.52941,1.529411 Q 13,8.941176 13,9.823529 z&quot;/&gt;&lt;/svg&gt;
          &lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;The Swift project adds new language features through the &lt;a href=&quot;/swift-evolution/&quot;&gt;Swift Evolution process&lt;/a&gt;. These are some of the proposals currently under review or recently accepted for a future Swift release.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Under active review:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;&lt;a href=&quot;https://github.com/swiftlang/swift-evolution/blob/main/proposals/testing/0029-add-issue-metadata-event-stream.md&quot;&gt;ST-0029&lt;/a&gt; Include additional issue metadata in event stream - Today, Swift Testing’s JSON event stream reports only bare-bones details when an issue occurs, making it hard to tell a thrown error apart from a manual &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Issue.record&lt;/code&gt; call. This proposal adds structured fields, including &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;error&lt;/code&gt;, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;confirmationMiscount&lt;/code&gt;, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;exceededTimeLimit&lt;/code&gt;, and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;expression&lt;/code&gt;, so tools like Xcode and VS Code can show richer, more specific failure information.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Recently accepted:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;&lt;a href=&quot;https://github.com/swiftlang/swift-evolution/blob/main/proposals/0544-mutate-or-consume-in-deinit.md&quot;&gt;SE-0544&lt;/a&gt; Mutation and consumption in non-copyable type &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;deinit&lt;/code&gt;s - Non-copyable types that manage a resource, like a file handle or buffer, often need to run the same cleanup logic in their &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;deinit&lt;/code&gt; that they use elsewhere, but until now &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;self&lt;/code&gt; inside a &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;deinit&lt;/code&gt; could only be borrowed, not mutated or consumed. This proposal lets a &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;deinit&lt;/code&gt; mutate or consume its own stored properties directly, so existing cleanup methods can be reused instead of duplicated.&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://github.com/swiftlang/swift-evolution/blob/main/proposals/testing/0028-revise-attachment-encodable-interfaces.md&quot;&gt;ST-0028&lt;/a&gt; Revise Swift Testing’s &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Attachment&lt;/code&gt;/&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Encodable&lt;/code&gt; interop - Swift Testing lets you attach extra data, like a screenshot or JSON snapshot, to a test for inspecting after a failure, but attaching custom types previously required extra setup code and offered no way to choose the encoding format. This proposal adds new &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Attachment&lt;/code&gt; initializers that let you attach &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Encodable&lt;/code&gt; or &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;NSSecureCoding&lt;/code&gt; values directly, picking the format or supplying your own encoder.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Recently accepted with modifications:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;&lt;a href=&quot;https://github.com/swiftlang/swift-evolution/blob/main/proposals/0536-registry-search.md&quot;&gt;SE-0536&lt;/a&gt; Package Registry Search - To use a package from a registry today, you already have to know its exact identifier, since there’s no standard way to discover packages within a registry the way other package ecosystems allow. This proposal adds an optional &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/search&lt;/code&gt; endpoint to the registry specification and a &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;swift package-registry search&lt;/code&gt; subcommand, letting you find packages by name, scope, author, and other criteria, with support for qualifiers like &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;author:&quot;Mona Lisa Octocat&quot;&lt;/code&gt; and searches that span every configured registry at once.&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://github.com/swiftlang/swift-evolution/blob/main/proposals/0516-borrowing-sequence.md&quot;&gt;SE-0516&lt;/a&gt; &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Iterable&lt;/code&gt; - Looping over a collection in Swift traditionally means copying out one element at a time, which doesn’t work for newer types that can’t be copied, like &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Span&lt;/code&gt; and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;InlineArray&lt;/code&gt;. This proposal introduces &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Iterable&lt;/code&gt;, a new way to loop over data without copying, and was renamed from &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;BorrowingSequence&lt;/code&gt; and given support for typed throws before acceptance.&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://github.com/swiftlang/swift-evolution/blob/main/proposals/testing/0026-task-local-test-trait.md&quot;&gt;ST-0026&lt;/a&gt; TaskLocal test trait - Task-local values are like settings, such as a feature flag, that apply only within a single task. Overriding one in a test previously meant writing a custom trait from scratch, but this proposal adds a &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;.taskLocal(_:_:)&lt;/code&gt; trait that does it in one line, like &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;@Suite(.taskLocal(FeatureFlags.$isEnabled, true))&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;
</content>
  </entry>
  
  <entry>
    <title>Embedded Swift Improvements Coming in Swift 6.4</title>
    
      
        
        <author>
        
          <name>Doug Gregor</name>
        
        </author>
      
    
    <link href="https://swift.org/blog/embedded-swift-improvements-coming-in-swift-6.4/"/>
    <updated>2026-08-20T09:45:00-04:00</updated>
    <id>https://swift.org/blog/embedded-swift-improvements-coming-in-swift-6.4/</id>
    <content type="html">&lt;p&gt;&lt;a href=&quot;/get-started/embedded/&quot;&gt;Embedded Swift&lt;/a&gt; is a subset of Swift that’s designed for low resource usage, making it capable of running on constrained environments like microcontrollers. Using a special compilation mode, Embedded Swift produces significantly smaller binaries than regular Swift. While a subset of the full language, the vast majority of the Swift language works exactly the same in Embedded Swift. Additional information is described in the &lt;a href=&quot;https://github.com/swiftlang/swift-evolution/blob/main/visions/embedded-swift.md&quot;&gt;Embedded Swift vision document&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Embedded Swift is evolving rapidly. Following our updates on &lt;a href=&quot;/blog/embedded-swift-improvements-coming-in-swift-6.3/&quot;&gt;Embedded Swift improvements in Swift 6.3&lt;/a&gt; late last year, this post describes a number of additional improvements made in the upcoming Swift 6.4 release. You can try them out today with a &lt;a href=&quot;/install/&quot;&gt;Swift development snapshot&lt;/a&gt;.&lt;/p&gt;

&lt;h2 id=&quot;language-improvements&quot; class=&quot;header-with-anchor&quot;&gt;Language improvements &lt;a title=&quot;Permalink for Language improvements section&quot; href=&quot;#language-improvements&quot;&gt;
            &lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt; &lt;svg width=&quot;18px&quot; height=&quot;18px&quot; viewBox=&quot;0 0 14 14&quot; role=&quot;img&quot; focusable=&quot;false&quot; aria-hidden=&quot;true&quot; xmlns=&quot;http://www.w3.org/2000/svg&quot;&gt;&lt;path d=&quot;m 11.58824,9.823529 q 0,-0.294117 -0.20589,-0.499999 L 9.85294,7.794118 q -0.20588,-0.205883 -0.5,-0.205883 -0.30882,0 -0.52941,0.235295 0.0221,0.02206 0.13971,0.136029 0.11764,0.113971 0.15808,0.158088 0.0404,0.04412 0.1103,0.139706 0.0698,0.09559 0.0956,0.1875 0.0257,0.09191 0.0257,0.202206 0,0.294117 -0.20588,0.5 -0.20588,0.205882 -0.5,0.205882 -0.1103,0 -0.20221,-0.02573 Q 8.35293,9.301471 8.25733,9.231621 8.16173,9.161771 8.11763,9.121327 8.07353,9.080887 7.95954,8.963238 7.84557,8.845591 7.82351,8.823533 7.58086,9.051474 7.58086,9.360297 q 0,0.294118 0.20588,0.5 l 1.51471,1.522059 q 0.19853,0.19853 0.5,0.19853 0.29412,0 0.5,-0.191177 l 1.08088,-1.073529 q 0.20589,-0.205883 0.20589,-0.492648 z M 6.41912,4.639706 q 0,-0.294118 -0.20588,-0.5 L 4.69853,2.617647 q -0.20588,-0.205882 -0.5,-0.205882 -0.28677,0 -0.5,0.198529 L 2.61765,3.683823 q -0.20589,0.205883 -0.20589,0.492648 0,0.294117 0.20589,0.499999 l 1.52941,1.529412 q 0.19853,0.19853 0.5,0.19853 0.30882,0 0.52941,-0.227942 Q 5.15437,6.15441 5.03676,6.040441 4.91912,5.92647 4.87868,5.882353 4.83828,5.838233 4.76838,5.742647 q -0.0698,-0.09559 -0.0956,-0.1875 -0.0257,-0.09191 -0.0257,-0.202206 0,-0.294117 0.20588,-0.5 0.20588,-0.205882 0.5,-0.205882 0.1103,0 0.20221,0.02573 0.0919,0.02573 0.1875,0.09559 0.0956,0.06985 0.1397,0.110294 0.0441,0.04044 0.15809,0.158089 Q 6.15443,5.154409 6.17649,5.176467 6.41914,4.948526 6.41914,4.639703 z M 13,9.823529 q 0,0.882353 -0.625,1.492647 l -1.08088,1.07353 Q 10.68382,13 9.80147,13 q -0.88971,0 -1.5,-0.625 L 6.78676,10.852941 Q 6.17647,10.242647 6.17647,9.360294 q 0,-0.904412 0.64706,-1.536764 L 6.17647,7.176471 Q 5.54412,7.82353 4.64706,7.82353 q -0.88235,0 -1.5,-0.617648 L 1.617647,5.676471 Q 1,5.058824 1,4.176471 1,3.294118 1.625,2.683824 L 2.70588,1.610294 Q 3.31618,1 4.19853,1 q 0.88971,0 1.5,0.625 l 1.51471,1.522059 q 0.61029,0.610294 0.61029,1.492647 0,0.904412 -0.64706,1.536764 L 7.82353,6.823529 Q 8.45588,6.17647 9.35294,6.17647 q 0.88235,0 1.5,0.617648 l 1.52941,1.529411 Q 13,8.941176 13,9.823529 z&quot;/&gt;&lt;/svg&gt;
          &lt;/a&gt;&lt;/h2&gt;

&lt;p&gt;Embedded Swift continues to expand its subset of the language to include more aspects of “full” Swift, making it easier than ever to bring compatibility with Embedded Swift to existing Swift code bases. Many of these features have some dynamic aspect to them, meaning that they have an impact on runtime performance (for example, due to indirect calls) and code size (due to requiring additional metadata). However, this impact only occurs where these dynamic language features are actually used: code that is highly sensitive to code size and performance can choose to avoid them, for example by enabling warnings in the &lt;a href=&quot;https://docs.swift.org/compiler/documentation/diagnostics/performance-hints&quot;&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;PerformanceHints&lt;/code&gt; diagnostic group&lt;/a&gt;.&lt;/p&gt;

&lt;h3 id=&quot;generalized-support-for-existential-any-types&quot; class=&quot;header-with-anchor&quot;&gt;Generalized support for existential (&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;any&lt;/code&gt;) types &lt;a title=&quot;Permalink for Generalized support for existential (&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;any&lt;/code&gt;) types section&quot; href=&quot;#generalized-support-for-existential-any-types&quot;&gt;
            &lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt; &lt;svg width=&quot;18px&quot; height=&quot;18px&quot; viewBox=&quot;0 0 14 14&quot; role=&quot;img&quot; focusable=&quot;false&quot; aria-hidden=&quot;true&quot; xmlns=&quot;http://www.w3.org/2000/svg&quot;&gt;&lt;path d=&quot;m 11.58824,9.823529 q 0,-0.294117 -0.20589,-0.499999 L 9.85294,7.794118 q -0.20588,-0.205883 -0.5,-0.205883 -0.30882,0 -0.52941,0.235295 0.0221,0.02206 0.13971,0.136029 0.11764,0.113971 0.15808,0.158088 0.0404,0.04412 0.1103,0.139706 0.0698,0.09559 0.0956,0.1875 0.0257,0.09191 0.0257,0.202206 0,0.294117 -0.20588,0.5 -0.20588,0.205882 -0.5,0.205882 -0.1103,0 -0.20221,-0.02573 Q 8.35293,9.301471 8.25733,9.231621 8.16173,9.161771 8.11763,9.121327 8.07353,9.080887 7.95954,8.963238 7.84557,8.845591 7.82351,8.823533 7.58086,9.051474 7.58086,9.360297 q 0,0.294118 0.20588,0.5 l 1.51471,1.522059 q 0.19853,0.19853 0.5,0.19853 0.29412,0 0.5,-0.191177 l 1.08088,-1.073529 q 0.20589,-0.205883 0.20589,-0.492648 z M 6.41912,4.639706 q 0,-0.294118 -0.20588,-0.5 L 4.69853,2.617647 q -0.20588,-0.205882 -0.5,-0.205882 -0.28677,0 -0.5,0.198529 L 2.61765,3.683823 q -0.20589,0.205883 -0.20589,0.492648 0,0.294117 0.20589,0.499999 l 1.52941,1.529412 q 0.19853,0.19853 0.5,0.19853 0.30882,0 0.52941,-0.227942 Q 5.15437,6.15441 5.03676,6.040441 4.91912,5.92647 4.87868,5.882353 4.83828,5.838233 4.76838,5.742647 q -0.0698,-0.09559 -0.0956,-0.1875 -0.0257,-0.09191 -0.0257,-0.202206 0,-0.294117 0.20588,-0.5 0.20588,-0.205882 0.5,-0.205882 0.1103,0 0.20221,0.02573 0.0919,0.02573 0.1875,0.09559 0.0956,0.06985 0.1397,0.110294 0.0441,0.04044 0.15809,0.158089 Q 6.15443,5.154409 6.17649,5.176467 6.41914,4.948526 6.41914,4.639703 z M 13,9.823529 q 0,0.882353 -0.625,1.492647 l -1.08088,1.07353 Q 10.68382,13 9.80147,13 q -0.88971,0 -1.5,-0.625 L 6.78676,10.852941 Q 6.17647,10.242647 6.17647,9.360294 q 0,-0.904412 0.64706,-1.536764 L 6.17647,7.176471 Q 5.54412,7.82353 4.64706,7.82353 q -0.88235,0 -1.5,-0.617648 L 1.617647,5.676471 Q 1,5.058824 1,4.176471 1,3.294118 1.625,2.683824 L 2.70588,1.610294 Q 3.31618,1 4.19853,1 q 0.88971,0 1.5,0.625 l 1.51471,1.522059 q 0.61029,0.610294 0.61029,1.492647 0,0.904412 -0.64706,1.536764 L 7.82353,6.823529 Q 8.45588,6.17647 9.35294,6.17647 q 0.88235,0 1.5,0.617648 l 1.52941,1.529411 Q 13,8.941176 13,9.823529 z&quot;/&gt;&lt;/svg&gt;
          &lt;/a&gt;&lt;/h3&gt;

&lt;p&gt;Embedded Swift previously only supported existential (&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;any&lt;/code&gt;) types that had an &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;AnyObject&lt;/code&gt; constraint, meaning they could only be used with class instances. Now, all &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;any&lt;/code&gt; types are available in Embedded Swift, including &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Any&lt;/code&gt; itself. For example:&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;protocol P {
  func method()
}

extension Int: P {
  func method() { print(&quot;\(self) is here&quot;) }
}

let a: any P = 17
a.method() // prints &quot;17 is here&quot;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;The Embedded Swift generics compilation model, which requires that all generic functions and types eventually be specialized, implies some limitations on the use of &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;any&lt;/code&gt; types. Specifically, a generic function cannot be called on an &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;any&lt;/code&gt; type:&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;extension P {
  func genericMethod&amp;lt;T: P&amp;gt;(_ other: T) { ... }
}

let a: any P = 17
a.genericMethod(a) // error: cannot use generic instance method &apos;genericMethod&apos; on a value of type &apos;any P&apos; in Embedded Swift
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h3 id=&quot;untyped-throws&quot; class=&quot;header-with-anchor&quot;&gt;Untyped throws &lt;a title=&quot;Permalink for Untyped throws section&quot; href=&quot;#untyped-throws&quot;&gt;
            &lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt; &lt;svg width=&quot;18px&quot; height=&quot;18px&quot; viewBox=&quot;0 0 14 14&quot; role=&quot;img&quot; focusable=&quot;false&quot; aria-hidden=&quot;true&quot; xmlns=&quot;http://www.w3.org/2000/svg&quot;&gt;&lt;path d=&quot;m 11.58824,9.823529 q 0,-0.294117 -0.20589,-0.499999 L 9.85294,7.794118 q -0.20588,-0.205883 -0.5,-0.205883 -0.30882,0 -0.52941,0.235295 0.0221,0.02206 0.13971,0.136029 0.11764,0.113971 0.15808,0.158088 0.0404,0.04412 0.1103,0.139706 0.0698,0.09559 0.0956,0.1875 0.0257,0.09191 0.0257,0.202206 0,0.294117 -0.20588,0.5 -0.20588,0.205882 -0.5,0.205882 -0.1103,0 -0.20221,-0.02573 Q 8.35293,9.301471 8.25733,9.231621 8.16173,9.161771 8.11763,9.121327 8.07353,9.080887 7.95954,8.963238 7.84557,8.845591 7.82351,8.823533 7.58086,9.051474 7.58086,9.360297 q 0,0.294118 0.20588,0.5 l 1.51471,1.522059 q 0.19853,0.19853 0.5,0.19853 0.29412,0 0.5,-0.191177 l 1.08088,-1.073529 q 0.20589,-0.205883 0.20589,-0.492648 z M 6.41912,4.639706 q 0,-0.294118 -0.20588,-0.5 L 4.69853,2.617647 q -0.20588,-0.205882 -0.5,-0.205882 -0.28677,0 -0.5,0.198529 L 2.61765,3.683823 q -0.20589,0.205883 -0.20589,0.492648 0,0.294117 0.20589,0.499999 l 1.52941,1.529412 q 0.19853,0.19853 0.5,0.19853 0.30882,0 0.52941,-0.227942 Q 5.15437,6.15441 5.03676,6.040441 4.91912,5.92647 4.87868,5.882353 4.83828,5.838233 4.76838,5.742647 q -0.0698,-0.09559 -0.0956,-0.1875 -0.0257,-0.09191 -0.0257,-0.202206 0,-0.294117 0.20588,-0.5 0.20588,-0.205882 0.5,-0.205882 0.1103,0 0.20221,0.02573 0.0919,0.02573 0.1875,0.09559 0.0956,0.06985 0.1397,0.110294 0.0441,0.04044 0.15809,0.158089 Q 6.15443,5.154409 6.17649,5.176467 6.41914,4.948526 6.41914,4.639703 z M 13,9.823529 q 0,0.882353 -0.625,1.492647 l -1.08088,1.07353 Q 10.68382,13 9.80147,13 q -0.88971,0 -1.5,-0.625 L 6.78676,10.852941 Q 6.17647,10.242647 6.17647,9.360294 q 0,-0.904412 0.64706,-1.536764 L 6.17647,7.176471 Q 5.54412,7.82353 4.64706,7.82353 q -0.88235,0 -1.5,-0.617648 L 1.617647,5.676471 Q 1,5.058824 1,4.176471 1,3.294118 1.625,2.683824 L 2.70588,1.610294 Q 3.31618,1 4.19853,1 q 0.88971,0 1.5,0.625 l 1.51471,1.522059 q 0.61029,0.610294 0.61029,1.492647 0,0.904412 -0.64706,1.536764 L 7.82353,6.823529 Q 8.45588,6.17647 9.35294,6.17647 q 0.88235,0 1.5,0.617648 l 1.52941,1.529411 Q 13,8.941176 13,9.823529 z&quot;/&gt;&lt;/svg&gt;
          &lt;/a&gt;&lt;/h3&gt;

&lt;p&gt;Embedded Swift previously only allowed throwing specific error types, like this:&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;func parseRecord() throws(ParsingError) -&amp;gt; Record { ... }
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;“Untyped” throws, which can throw any &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Error&lt;/code&gt;-conforming instance, was previously disallowed in Embedded Swift:&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;func loadImage() throws -&amp;gt; Image { ... } // previously disallowed in Embedded Swift
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Untyped throws is equivalent to throwing a value of type &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;any Error&lt;/code&gt;. With the generalization of &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;any&lt;/code&gt; types, Embedded Swift now fully supports untyped throws. Throwing a value of &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;any Error&lt;/code&gt; typically requires a heap allocation, so typed throws should still be preferred for code bases that want to avoid heap allocations.&lt;/p&gt;

&lt;h3 id=&quot;metatypes&quot; class=&quot;header-with-anchor&quot;&gt;Metatypes &lt;a title=&quot;Permalink for Metatypes section&quot; href=&quot;#metatypes&quot;&gt;
            &lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt; &lt;svg width=&quot;18px&quot; height=&quot;18px&quot; viewBox=&quot;0 0 14 14&quot; role=&quot;img&quot; focusable=&quot;false&quot; aria-hidden=&quot;true&quot; xmlns=&quot;http://www.w3.org/2000/svg&quot;&gt;&lt;path d=&quot;m 11.58824,9.823529 q 0,-0.294117 -0.20589,-0.499999 L 9.85294,7.794118 q -0.20588,-0.205883 -0.5,-0.205883 -0.30882,0 -0.52941,0.235295 0.0221,0.02206 0.13971,0.136029 0.11764,0.113971 0.15808,0.158088 0.0404,0.04412 0.1103,0.139706 0.0698,0.09559 0.0956,0.1875 0.0257,0.09191 0.0257,0.202206 0,0.294117 -0.20588,0.5 -0.20588,0.205882 -0.5,0.205882 -0.1103,0 -0.20221,-0.02573 Q 8.35293,9.301471 8.25733,9.231621 8.16173,9.161771 8.11763,9.121327 8.07353,9.080887 7.95954,8.963238 7.84557,8.845591 7.82351,8.823533 7.58086,9.051474 7.58086,9.360297 q 0,0.294118 0.20588,0.5 l 1.51471,1.522059 q 0.19853,0.19853 0.5,0.19853 0.29412,0 0.5,-0.191177 l 1.08088,-1.073529 q 0.20589,-0.205883 0.20589,-0.492648 z M 6.41912,4.639706 q 0,-0.294118 -0.20588,-0.5 L 4.69853,2.617647 q -0.20588,-0.205882 -0.5,-0.205882 -0.28677,0 -0.5,0.198529 L 2.61765,3.683823 q -0.20589,0.205883 -0.20589,0.492648 0,0.294117 0.20589,0.499999 l 1.52941,1.529412 q 0.19853,0.19853 0.5,0.19853 0.30882,0 0.52941,-0.227942 Q 5.15437,6.15441 5.03676,6.040441 4.91912,5.92647 4.87868,5.882353 4.83828,5.838233 4.76838,5.742647 q -0.0698,-0.09559 -0.0956,-0.1875 -0.0257,-0.09191 -0.0257,-0.202206 0,-0.294117 0.20588,-0.5 0.20588,-0.205882 0.5,-0.205882 0.1103,0 0.20221,0.02573 0.0919,0.02573 0.1875,0.09559 0.0956,0.06985 0.1397,0.110294 0.0441,0.04044 0.15809,0.158089 Q 6.15443,5.154409 6.17649,5.176467 6.41914,4.948526 6.41914,4.639703 z M 13,9.823529 q 0,0.882353 -0.625,1.492647 l -1.08088,1.07353 Q 10.68382,13 9.80147,13 q -0.88971,0 -1.5,-0.625 L 6.78676,10.852941 Q 6.17647,10.242647 6.17647,9.360294 q 0,-0.904412 0.64706,-1.536764 L 6.17647,7.176471 Q 5.54412,7.82353 4.64706,7.82353 q -0.88235,0 -1.5,-0.617648 L 1.617647,5.676471 Q 1,5.058824 1,4.176471 1,3.294118 1.625,2.683824 L 2.70588,1.610294 Q 3.31618,1 4.19853,1 q 0.88971,0 1.5,0.625 l 1.51471,1.522059 q 0.61029,0.610294 0.61029,1.492647 0,0.904412 -0.64706,1.536764 L 7.82353,6.823529 Q 8.45588,6.17647 9.35294,6.17647 q 0.88235,0 1.5,0.617648 l 1.52941,1.529411 Q 13,8.941176 13,9.823529 z&quot;/&gt;&lt;/svg&gt;
          &lt;/a&gt;&lt;/h3&gt;

&lt;p&gt;Embedded Swift has traditionally allowed metatypes (e.g., &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Int.self&lt;/code&gt;) only in very narrow places, for example when using them to specify argument types for generic functions:&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;rawPointer.bindMemory(to: Value.self, capacity: 1)
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Swift 6.4 introduces complete support for metatypes in Embedded Swift: one can create and use instances of metatypes, including existential types like &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;any (DefaultInitializable.Type)&lt;/code&gt;. For example, this is now permitted and works in the same way as full Swift:&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;protocol DefaultInitializable {
  init()
}

extension Int: DefaultInitializable { }

let factory: any (DefaultInitializable.Type) = Int.self
let aValue: any DefaultInitializable = factory.init()
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h2 id=&quot;library-improvements&quot; class=&quot;header-with-anchor&quot;&gt;Library improvements &lt;a title=&quot;Permalink for Library improvements section&quot; href=&quot;#library-improvements&quot;&gt;
            &lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt; &lt;svg width=&quot;18px&quot; height=&quot;18px&quot; viewBox=&quot;0 0 14 14&quot; role=&quot;img&quot; focusable=&quot;false&quot; aria-hidden=&quot;true&quot; xmlns=&quot;http://www.w3.org/2000/svg&quot;&gt;&lt;path d=&quot;m 11.58824,9.823529 q 0,-0.294117 -0.20589,-0.499999 L 9.85294,7.794118 q -0.20588,-0.205883 -0.5,-0.205883 -0.30882,0 -0.52941,0.235295 0.0221,0.02206 0.13971,0.136029 0.11764,0.113971 0.15808,0.158088 0.0404,0.04412 0.1103,0.139706 0.0698,0.09559 0.0956,0.1875 0.0257,0.09191 0.0257,0.202206 0,0.294117 -0.20588,0.5 -0.20588,0.205882 -0.5,0.205882 -0.1103,0 -0.20221,-0.02573 Q 8.35293,9.301471 8.25733,9.231621 8.16173,9.161771 8.11763,9.121327 8.07353,9.080887 7.95954,8.963238 7.84557,8.845591 7.82351,8.823533 7.58086,9.051474 7.58086,9.360297 q 0,0.294118 0.20588,0.5 l 1.51471,1.522059 q 0.19853,0.19853 0.5,0.19853 0.29412,0 0.5,-0.191177 l 1.08088,-1.073529 q 0.20589,-0.205883 0.20589,-0.492648 z M 6.41912,4.639706 q 0,-0.294118 -0.20588,-0.5 L 4.69853,2.617647 q -0.20588,-0.205882 -0.5,-0.205882 -0.28677,0 -0.5,0.198529 L 2.61765,3.683823 q -0.20589,0.205883 -0.20589,0.492648 0,0.294117 0.20589,0.499999 l 1.52941,1.529412 q 0.19853,0.19853 0.5,0.19853 0.30882,0 0.52941,-0.227942 Q 5.15437,6.15441 5.03676,6.040441 4.91912,5.92647 4.87868,5.882353 4.83828,5.838233 4.76838,5.742647 q -0.0698,-0.09559 -0.0956,-0.1875 -0.0257,-0.09191 -0.0257,-0.202206 0,-0.294117 0.20588,-0.5 0.20588,-0.205882 0.5,-0.205882 0.1103,0 0.20221,0.02573 0.0919,0.02573 0.1875,0.09559 0.0956,0.06985 0.1397,0.110294 0.0441,0.04044 0.15809,0.158089 Q 6.15443,5.154409 6.17649,5.176467 6.41914,4.948526 6.41914,4.639703 z M 13,9.823529 q 0,0.882353 -0.625,1.492647 l -1.08088,1.07353 Q 10.68382,13 9.80147,13 q -0.88971,0 -1.5,-0.625 L 6.78676,10.852941 Q 6.17647,10.242647 6.17647,9.360294 q 0,-0.904412 0.64706,-1.536764 L 6.17647,7.176471 Q 5.54412,7.82353 4.64706,7.82353 q -0.88235,0 -1.5,-0.617648 L 1.617647,5.676471 Q 1,5.058824 1,4.176471 1,3.294118 1.625,2.683824 L 2.70588,1.610294 Q 3.31618,1 4.19853,1 q 0.88971,0 1.5,0.625 l 1.51471,1.522059 q 0.61029,0.610294 0.61029,1.492647 0,0.904412 -0.64706,1.536764 L 7.82353,6.823529 Q 8.45588,6.17647 9.35294,6.17647 q 0.88235,0 1.5,0.617648 l 1.52941,1.529411 Q 13,8.941176 13,9.823529 z&quot;/&gt;&lt;/svg&gt;
          &lt;/a&gt;&lt;/h2&gt;

&lt;p&gt;Additional features in the Swift standard library and associated libraries from full Swift are now available in Embedded Swift.&lt;/p&gt;

&lt;h3 id=&quot;floating-point-parsing&quot; class=&quot;header-with-anchor&quot;&gt;Floating point parsing &lt;a title=&quot;Permalink for Floating point parsing section&quot; href=&quot;#floating-point-parsing&quot;&gt;
            &lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt; &lt;svg width=&quot;18px&quot; height=&quot;18px&quot; viewBox=&quot;0 0 14 14&quot; role=&quot;img&quot; focusable=&quot;false&quot; aria-hidden=&quot;true&quot; xmlns=&quot;http://www.w3.org/2000/svg&quot;&gt;&lt;path d=&quot;m 11.58824,9.823529 q 0,-0.294117 -0.20589,-0.499999 L 9.85294,7.794118 q -0.20588,-0.205883 -0.5,-0.205883 -0.30882,0 -0.52941,0.235295 0.0221,0.02206 0.13971,0.136029 0.11764,0.113971 0.15808,0.158088 0.0404,0.04412 0.1103,0.139706 0.0698,0.09559 0.0956,0.1875 0.0257,0.09191 0.0257,0.202206 0,0.294117 -0.20588,0.5 -0.20588,0.205882 -0.5,0.205882 -0.1103,0 -0.20221,-0.02573 Q 8.35293,9.301471 8.25733,9.231621 8.16173,9.161771 8.11763,9.121327 8.07353,9.080887 7.95954,8.963238 7.84557,8.845591 7.82351,8.823533 7.58086,9.051474 7.58086,9.360297 q 0,0.294118 0.20588,0.5 l 1.51471,1.522059 q 0.19853,0.19853 0.5,0.19853 0.29412,0 0.5,-0.191177 l 1.08088,-1.073529 q 0.20589,-0.205883 0.20589,-0.492648 z M 6.41912,4.639706 q 0,-0.294118 -0.20588,-0.5 L 4.69853,2.617647 q -0.20588,-0.205882 -0.5,-0.205882 -0.28677,0 -0.5,0.198529 L 2.61765,3.683823 q -0.20589,0.205883 -0.20589,0.492648 0,0.294117 0.20589,0.499999 l 1.52941,1.529412 q 0.19853,0.19853 0.5,0.19853 0.30882,0 0.52941,-0.227942 Q 5.15437,6.15441 5.03676,6.040441 4.91912,5.92647 4.87868,5.882353 4.83828,5.838233 4.76838,5.742647 q -0.0698,-0.09559 -0.0956,-0.1875 -0.0257,-0.09191 -0.0257,-0.202206 0,-0.294117 0.20588,-0.5 0.20588,-0.205882 0.5,-0.205882 0.1103,0 0.20221,0.02573 0.0919,0.02573 0.1875,0.09559 0.0956,0.06985 0.1397,0.110294 0.0441,0.04044 0.15809,0.158089 Q 6.15443,5.154409 6.17649,5.176467 6.41914,4.948526 6.41914,4.639703 z M 13,9.823529 q 0,0.882353 -0.625,1.492647 l -1.08088,1.07353 Q 10.68382,13 9.80147,13 q -0.88971,0 -1.5,-0.625 L 6.78676,10.852941 Q 6.17647,10.242647 6.17647,9.360294 q 0,-0.904412 0.64706,-1.536764 L 6.17647,7.176471 Q 5.54412,7.82353 4.64706,7.82353 q -0.88235,0 -1.5,-0.617648 L 1.617647,5.676471 Q 1,5.058824 1,4.176471 1,3.294118 1.625,2.683824 L 2.70588,1.610294 Q 3.31618,1 4.19853,1 q 0.88971,0 1.5,0.625 l 1.51471,1.522059 q 0.61029,0.610294 0.61029,1.492647 0,0.904412 -0.64706,1.536764 L 7.82353,6.823529 Q 8.45588,6.17647 9.35294,6.17647 q 0.88235,0 1.5,0.617648 l 1.52941,1.529411 Q 13,8.941176 13,9.823529 z&quot;/&gt;&lt;/svg&gt;
          &lt;/a&gt;&lt;/h3&gt;

&lt;p&gt;Swift floating point values can be parsed from a string, like this:&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;let inputText: String = getInputText()
if let value = Double(inputText) {
  // value is a Double
}
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;As part of a &lt;a href=&quot;https://github.com/swiftlang/swift/pull/85797&quot;&gt;reimplementation of this functionality in Swift&lt;/a&gt;, these floating-point parsing APIs are now available in Embedded Swift as well.&lt;/p&gt;

&lt;h3 id=&quot;concurrency-error-handling&quot; class=&quot;header-with-anchor&quot;&gt;Concurrency error handling &lt;a title=&quot;Permalink for Concurrency error handling section&quot; href=&quot;#concurrency-error-handling&quot;&gt;
            &lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt; &lt;svg width=&quot;18px&quot; height=&quot;18px&quot; viewBox=&quot;0 0 14 14&quot; role=&quot;img&quot; focusable=&quot;false&quot; aria-hidden=&quot;true&quot; xmlns=&quot;http://www.w3.org/2000/svg&quot;&gt;&lt;path d=&quot;m 11.58824,9.823529 q 0,-0.294117 -0.20589,-0.499999 L 9.85294,7.794118 q -0.20588,-0.205883 -0.5,-0.205883 -0.30882,0 -0.52941,0.235295 0.0221,0.02206 0.13971,0.136029 0.11764,0.113971 0.15808,0.158088 0.0404,0.04412 0.1103,0.139706 0.0698,0.09559 0.0956,0.1875 0.0257,0.09191 0.0257,0.202206 0,0.294117 -0.20588,0.5 -0.20588,0.205882 -0.5,0.205882 -0.1103,0 -0.20221,-0.02573 Q 8.35293,9.301471 8.25733,9.231621 8.16173,9.161771 8.11763,9.121327 8.07353,9.080887 7.95954,8.963238 7.84557,8.845591 7.82351,8.823533 7.58086,9.051474 7.58086,9.360297 q 0,0.294118 0.20588,0.5 l 1.51471,1.522059 q 0.19853,0.19853 0.5,0.19853 0.29412,0 0.5,-0.191177 l 1.08088,-1.073529 q 0.20589,-0.205883 0.20589,-0.492648 z M 6.41912,4.639706 q 0,-0.294118 -0.20588,-0.5 L 4.69853,2.617647 q -0.20588,-0.205882 -0.5,-0.205882 -0.28677,0 -0.5,0.198529 L 2.61765,3.683823 q -0.20589,0.205883 -0.20589,0.492648 0,0.294117 0.20589,0.499999 l 1.52941,1.529412 q 0.19853,0.19853 0.5,0.19853 0.30882,0 0.52941,-0.227942 Q 5.15437,6.15441 5.03676,6.040441 4.91912,5.92647 4.87868,5.882353 4.83828,5.838233 4.76838,5.742647 q -0.0698,-0.09559 -0.0956,-0.1875 -0.0257,-0.09191 -0.0257,-0.202206 0,-0.294117 0.20588,-0.5 0.20588,-0.205882 0.5,-0.205882 0.1103,0 0.20221,0.02573 0.0919,0.02573 0.1875,0.09559 0.0956,0.06985 0.1397,0.110294 0.0441,0.04044 0.15809,0.158089 Q 6.15443,5.154409 6.17649,5.176467 6.41914,4.948526 6.41914,4.639703 z M 13,9.823529 q 0,0.882353 -0.625,1.492647 l -1.08088,1.07353 Q 10.68382,13 9.80147,13 q -0.88971,0 -1.5,-0.625 L 6.78676,10.852941 Q 6.17647,10.242647 6.17647,9.360294 q 0,-0.904412 0.64706,-1.536764 L 6.17647,7.176471 Q 5.54412,7.82353 4.64706,7.82353 q -0.88235,0 -1.5,-0.617648 L 1.617647,5.676471 Q 1,5.058824 1,4.176471 1,3.294118 1.625,2.683824 L 2.70588,1.610294 Q 3.31618,1 4.19853,1 q 0.88971,0 1.5,0.625 l 1.51471,1.522059 q 0.61029,0.610294 0.61029,1.492647 0,0.904412 -0.64706,1.536764 L 7.82353,6.823529 Q 8.45588,6.17647 9.35294,6.17647 q 0.88235,0 1.5,0.617648 l 1.52941,1.529411 Q 13,8.941176 13,9.823529 z&quot;/&gt;&lt;/svg&gt;
          &lt;/a&gt;&lt;/h3&gt;

&lt;p&gt;The Embedded Swift concurrency library now supports throwing operations, such as throwing tasks and task groups. For example:&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;let task = Task {
  if badThing {
    throw MyError.badThingHappened
  }

  return &quot;ok&quot;
}

print(try await task.value)
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h2 id=&quot;try-it-out&quot; class=&quot;header-with-anchor&quot;&gt;Try it out! &lt;a title=&quot;Permalink for Try it out! section&quot; href=&quot;#try-it-out&quot;&gt;
            &lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt; &lt;svg width=&quot;18px&quot; height=&quot;18px&quot; viewBox=&quot;0 0 14 14&quot; role=&quot;img&quot; focusable=&quot;false&quot; aria-hidden=&quot;true&quot; xmlns=&quot;http://www.w3.org/2000/svg&quot;&gt;&lt;path d=&quot;m 11.58824,9.823529 q 0,-0.294117 -0.20589,-0.499999 L 9.85294,7.794118 q -0.20588,-0.205883 -0.5,-0.205883 -0.30882,0 -0.52941,0.235295 0.0221,0.02206 0.13971,0.136029 0.11764,0.113971 0.15808,0.158088 0.0404,0.04412 0.1103,0.139706 0.0698,0.09559 0.0956,0.1875 0.0257,0.09191 0.0257,0.202206 0,0.294117 -0.20588,0.5 -0.20588,0.205882 -0.5,0.205882 -0.1103,0 -0.20221,-0.02573 Q 8.35293,9.301471 8.25733,9.231621 8.16173,9.161771 8.11763,9.121327 8.07353,9.080887 7.95954,8.963238 7.84557,8.845591 7.82351,8.823533 7.58086,9.051474 7.58086,9.360297 q 0,0.294118 0.20588,0.5 l 1.51471,1.522059 q 0.19853,0.19853 0.5,0.19853 0.29412,0 0.5,-0.191177 l 1.08088,-1.073529 q 0.20589,-0.205883 0.20589,-0.492648 z M 6.41912,4.639706 q 0,-0.294118 -0.20588,-0.5 L 4.69853,2.617647 q -0.20588,-0.205882 -0.5,-0.205882 -0.28677,0 -0.5,0.198529 L 2.61765,3.683823 q -0.20589,0.205883 -0.20589,0.492648 0,0.294117 0.20589,0.499999 l 1.52941,1.529412 q 0.19853,0.19853 0.5,0.19853 0.30882,0 0.52941,-0.227942 Q 5.15437,6.15441 5.03676,6.040441 4.91912,5.92647 4.87868,5.882353 4.83828,5.838233 4.76838,5.742647 q -0.0698,-0.09559 -0.0956,-0.1875 -0.0257,-0.09191 -0.0257,-0.202206 0,-0.294117 0.20588,-0.5 0.20588,-0.205882 0.5,-0.205882 0.1103,0 0.20221,0.02573 0.0919,0.02573 0.1875,0.09559 0.0956,0.06985 0.1397,0.110294 0.0441,0.04044 0.15809,0.158089 Q 6.15443,5.154409 6.17649,5.176467 6.41914,4.948526 6.41914,4.639703 z M 13,9.823529 q 0,0.882353 -0.625,1.492647 l -1.08088,1.07353 Q 10.68382,13 9.80147,13 q -0.88971,0 -1.5,-0.625 L 6.78676,10.852941 Q 6.17647,10.242647 6.17647,9.360294 q 0,-0.904412 0.64706,-1.536764 L 6.17647,7.176471 Q 5.54412,7.82353 4.64706,7.82353 q -0.88235,0 -1.5,-0.617648 L 1.617647,5.676471 Q 1,5.058824 1,4.176471 1,3.294118 1.625,2.683824 L 2.70588,1.610294 Q 3.31618,1 4.19853,1 q 0.88971,0 1.5,0.625 l 1.51471,1.522059 q 0.61029,0.610294 0.61029,1.492647 0,0.904412 -0.64706,1.536764 L 7.82353,6.823529 Q 8.45588,6.17647 9.35294,6.17647 q 0.88235,0 1.5,0.617648 l 1.52941,1.529411 Q 13,8.941176 13,9.823529 z&quot;/&gt;&lt;/svg&gt;
          &lt;/a&gt;&lt;/h2&gt;

&lt;p&gt;Embedded Swift support is available in the &lt;a href=&quot;/install/&quot;&gt;Swift development snapshots&lt;/a&gt;. The best way to get started is through the examples in the &lt;a href=&quot;https://github.com/swiftlang/swift-embedded-examples&quot;&gt;Swift Embedded Examples&lt;/a&gt; repository, which contains a number of sample projects to get Embedded Swift code building and running on various hardware.&lt;/p&gt;

&lt;p&gt;If you have questions about the improvements described here, or want to discuss your own Embedded Swift work, we encourage you to join the conversation on the Swift forums. You can ask about this post in the &lt;a href=&quot;https://forums.swift.org/t/embedded-swift-improvements-coming-in-swift-6-4/89085&quot;&gt;associated thread&lt;/a&gt;, and share your experiences in the &lt;a href=&quot;https://forums.swift.org/c/platform/embedded/&quot;&gt;Embedded Swift category&lt;/a&gt;.&lt;/p&gt;
</content>
  </entry>
  
  <entry>
    <title>What's new in Swift: July 2026 Edition</title>
    
      
        
        <author>
        
          <name>Alexander Sandberg</name>
        
        </author>
      
        
        <author>
        
          <name>Dave Lester</name>
        
        </author>
      
    
    <link href="https://swift.org/blog/whats-new-in-swift-july-2026/"/>
    <updated>2026-08-07T11:30:00-04:00</updated>
    <id>https://swift.org/blog/whats-new-in-swift-july-2026/</id>
    <content type="html">&lt;p&gt;Welcome to “What’s new in Swift,” a curated digest of releases, videos, and discussions in the Swift project and community.&lt;/p&gt;

&lt;p&gt;Swift is built by contributors working on far more than the language and compiler. Alexander Sandberg reflects on what that kind of contribution looks like, and why there’s a place for you too:&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;Hi, I’m Alex. Four years ago I joined the Swift Website Workgroup to help care for the website you’re reading this on. I was still fairly new to the Swift community then, but I wanted to get involved somehow and make a difference.&lt;/p&gt;

  &lt;p&gt;Contributing to Swift sounds like it should involve working on the compiler or writing and reviewing language evolution proposals, but there’s a lot going on around the language itself too. What I actually spent my time doing was helping improve the site’s content and navigation, taking part in the big redesign, writing release blog posts, reviewing pull requests, and answering issues and forum posts. All of it is work anyone can learn to do, and all of it ends up in front of everyone who comes to Swift.org—which made even the smallest fixes feel worth doing.&lt;/p&gt;

  &lt;p&gt;The Website Workgroup happened to be my way in, but there are groups like it across the project—server, testing, Windows, Android, and more—each a handful of people looking after their part of the ecosystem. Whatever you’re good at or curious about, there’s probably a corner of Swift that could use your help. The &lt;a href=&quot;/community/&quot;&gt;community page&lt;/a&gt; is a good place to start looking, and the people you’ll meet are some of the friendliest I’ve come across in open source.&lt;/p&gt;

  &lt;p&gt;After four years, &lt;a href=&quot;https://alexandersandberg.com/articles/leaving-the-swift-website-workgroup/&quot;&gt;I’ve stepped away to focus on other things in life&lt;/a&gt;. Thank you to everyone I got to work with over these years! I’m leaving the workgroup, but not the community, and I’ll still be around helping push Swift forward where I can.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;For more information about workgroups, the &lt;a href=&quot;/community/how-we-work/&quot;&gt;How we work page&lt;/a&gt; lists all workgroups. And on the &lt;a href=&quot;https://forums.swift.org&quot;&gt;Swift forums&lt;/a&gt; you’ll often see workgroups sharing open meetings if you’re looking to get involved!&lt;/p&gt;

&lt;p&gt;Now on to other news about Swift:&lt;/p&gt;

&lt;h2 id=&quot;videos-to-watch&quot; class=&quot;header-with-anchor&quot;&gt;Videos to watch &lt;a title=&quot;Permalink for Videos to watch section&quot; href=&quot;#videos-to-watch&quot;&gt;
            &lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt; &lt;svg width=&quot;18px&quot; height=&quot;18px&quot; viewBox=&quot;0 0 14 14&quot; role=&quot;img&quot; focusable=&quot;false&quot; aria-hidden=&quot;true&quot; xmlns=&quot;http://www.w3.org/2000/svg&quot;&gt;&lt;path d=&quot;m 11.58824,9.823529 q 0,-0.294117 -0.20589,-0.499999 L 9.85294,7.794118 q -0.20588,-0.205883 -0.5,-0.205883 -0.30882,0 -0.52941,0.235295 0.0221,0.02206 0.13971,0.136029 0.11764,0.113971 0.15808,0.158088 0.0404,0.04412 0.1103,0.139706 0.0698,0.09559 0.0956,0.1875 0.0257,0.09191 0.0257,0.202206 0,0.294117 -0.20588,0.5 -0.20588,0.205882 -0.5,0.205882 -0.1103,0 -0.20221,-0.02573 Q 8.35293,9.301471 8.25733,9.231621 8.16173,9.161771 8.11763,9.121327 8.07353,9.080887 7.95954,8.963238 7.84557,8.845591 7.82351,8.823533 7.58086,9.051474 7.58086,9.360297 q 0,0.294118 0.20588,0.5 l 1.51471,1.522059 q 0.19853,0.19853 0.5,0.19853 0.29412,0 0.5,-0.191177 l 1.08088,-1.073529 q 0.20589,-0.205883 0.20589,-0.492648 z M 6.41912,4.639706 q 0,-0.294118 -0.20588,-0.5 L 4.69853,2.617647 q -0.20588,-0.205882 -0.5,-0.205882 -0.28677,0 -0.5,0.198529 L 2.61765,3.683823 q -0.20589,0.205883 -0.20589,0.492648 0,0.294117 0.20589,0.499999 l 1.52941,1.529412 q 0.19853,0.19853 0.5,0.19853 0.30882,0 0.52941,-0.227942 Q 5.15437,6.15441 5.03676,6.040441 4.91912,5.92647 4.87868,5.882353 4.83828,5.838233 4.76838,5.742647 q -0.0698,-0.09559 -0.0956,-0.1875 -0.0257,-0.09191 -0.0257,-0.202206 0,-0.294117 0.20588,-0.5 0.20588,-0.205882 0.5,-0.205882 0.1103,0 0.20221,0.02573 0.0919,0.02573 0.1875,0.09559 0.0956,0.06985 0.1397,0.110294 0.0441,0.04044 0.15809,0.158089 Q 6.15443,5.154409 6.17649,5.176467 6.41914,4.948526 6.41914,4.639703 z M 13,9.823529 q 0,0.882353 -0.625,1.492647 l -1.08088,1.07353 Q 10.68382,13 9.80147,13 q -0.88971,0 -1.5,-0.625 L 6.78676,10.852941 Q 6.17647,10.242647 6.17647,9.360294 q 0,-0.904412 0.64706,-1.536764 L 6.17647,7.176471 Q 5.54412,7.82353 4.64706,7.82353 q -0.88235,0 -1.5,-0.617648 L 1.617647,5.676471 Q 1,5.058824 1,4.176471 1,3.294118 1.625,2.683824 L 2.70588,1.610294 Q 3.31618,1 4.19853,1 q 0.88971,0 1.5,0.625 l 1.51471,1.522059 q 0.61029,0.610294 0.61029,1.492647 0,0.904412 -0.64706,1.536764 L 7.82353,6.823529 Q 8.45588,6.17647 9.35294,6.17647 q 0.88235,0 1.5,0.617648 l 1.52941,1.529411 Q 13,8.941176 13,9.823529 z&quot;/&gt;&lt;/svg&gt;
          &lt;/a&gt;&lt;/h2&gt;
&lt;ul&gt;
  &lt;li&gt;&lt;a href=&quot;https://www.youtube.com/watch?v=MJBagt6Zp2g&quot;&gt;Balancing High and Low-Level Programming in Swift&lt;/a&gt;, presented by John McCall at PLDI 2026, digs into the ongoing work to bring explicit ownership and lifetime features to Swift for systems programming, and the tricky balance of fitting them into a language built around simple, low-friction application development without breaking source compatibility or ABI stability.&lt;/li&gt;
  &lt;li&gt;Speaking of low-level Swift: &lt;a href=&quot;https://www.youtube.com/watch?v=Fs27ooAUbzk&quot;&gt;I Built a Timer for the Playdate in Swift&lt;/a&gt; and &lt;a href=&quot;https://www.youtube.com/watch?v=-uo-c9tzYnE&quot;&gt;I Built a 3D Renderer for the Playdate (in Swift)&lt;/a&gt; are a fun pair of videos on building for the handheld game console in Swift.&lt;/li&gt;
  &lt;li&gt;Melbourne CocoaHeads has been uploading a great back catalog of past event talks to their YouTube channel, including &lt;a href=&quot;https://www.youtube.com/watch?v=V0G6hOwJPhw&quot;&gt;Christian Mitteldorf’s 2023 talk on running Swift on the server&lt;/a&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;recent-project-changes&quot; class=&quot;header-with-anchor&quot;&gt;Recent project changes &lt;a title=&quot;Permalink for Recent project changes section&quot; href=&quot;#recent-project-changes&quot;&gt;
            &lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt; &lt;svg width=&quot;18px&quot; height=&quot;18px&quot; viewBox=&quot;0 0 14 14&quot; role=&quot;img&quot; focusable=&quot;false&quot; aria-hidden=&quot;true&quot; xmlns=&quot;http://www.w3.org/2000/svg&quot;&gt;&lt;path d=&quot;m 11.58824,9.823529 q 0,-0.294117 -0.20589,-0.499999 L 9.85294,7.794118 q -0.20588,-0.205883 -0.5,-0.205883 -0.30882,0 -0.52941,0.235295 0.0221,0.02206 0.13971,0.136029 0.11764,0.113971 0.15808,0.158088 0.0404,0.04412 0.1103,0.139706 0.0698,0.09559 0.0956,0.1875 0.0257,0.09191 0.0257,0.202206 0,0.294117 -0.20588,0.5 -0.20588,0.205882 -0.5,0.205882 -0.1103,0 -0.20221,-0.02573 Q 8.35293,9.301471 8.25733,9.231621 8.16173,9.161771 8.11763,9.121327 8.07353,9.080887 7.95954,8.963238 7.84557,8.845591 7.82351,8.823533 7.58086,9.051474 7.58086,9.360297 q 0,0.294118 0.20588,0.5 l 1.51471,1.522059 q 0.19853,0.19853 0.5,0.19853 0.29412,0 0.5,-0.191177 l 1.08088,-1.073529 q 0.20589,-0.205883 0.20589,-0.492648 z M 6.41912,4.639706 q 0,-0.294118 -0.20588,-0.5 L 4.69853,2.617647 q -0.20588,-0.205882 -0.5,-0.205882 -0.28677,0 -0.5,0.198529 L 2.61765,3.683823 q -0.20589,0.205883 -0.20589,0.492648 0,0.294117 0.20589,0.499999 l 1.52941,1.529412 q 0.19853,0.19853 0.5,0.19853 0.30882,0 0.52941,-0.227942 Q 5.15437,6.15441 5.03676,6.040441 4.91912,5.92647 4.87868,5.882353 4.83828,5.838233 4.76838,5.742647 q -0.0698,-0.09559 -0.0956,-0.1875 -0.0257,-0.09191 -0.0257,-0.202206 0,-0.294117 0.20588,-0.5 0.20588,-0.205882 0.5,-0.205882 0.1103,0 0.20221,0.02573 0.0919,0.02573 0.1875,0.09559 0.0956,0.06985 0.1397,0.110294 0.0441,0.04044 0.15809,0.158089 Q 6.15443,5.154409 6.17649,5.176467 6.41914,4.948526 6.41914,4.639703 z M 13,9.823529 q 0,0.882353 -0.625,1.492647 l -1.08088,1.07353 Q 10.68382,13 9.80147,13 q -0.88971,0 -1.5,-0.625 L 6.78676,10.852941 Q 6.17647,10.242647 6.17647,9.360294 q 0,-0.904412 0.64706,-1.536764 L 6.17647,7.176471 Q 5.54412,7.82353 4.64706,7.82353 q -0.88235,0 -1.5,-0.617648 L 1.617647,5.676471 Q 1,5.058824 1,4.176471 1,3.294118 1.625,2.683824 L 2.70588,1.610294 Q 3.31618,1 4.19853,1 q 0.88971,0 1.5,0.625 l 1.51471,1.522059 q 0.61029,0.610294 0.61029,1.492647 0,0.904412 -0.64706,1.536764 L 7.82353,6.823529 Q 8.45588,6.17647 9.35294,6.17647 q 0.88235,0 1.5,0.617648 l 1.52941,1.529411 Q 13,8.941176 13,9.823529 z&quot;/&gt;&lt;/svg&gt;
          &lt;/a&gt;&lt;/h2&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;strong&gt;Google Summer of Code contributions are underway&lt;/strong&gt;: Ege Kaya is building a Task Registry for the Swift Concurrency runtime (&lt;a href=&quot;https://github.com/swiftlang/swift/pull/90547&quot;&gt;PR #90547&lt;/a&gt;), Filip Sakellariou is contributing to swift-syntax (&lt;a href=&quot;https://github.com/swiftlang/swift-syntax/pull/3378&quot;&gt;PR #3378&lt;/a&gt;, &lt;a href=&quot;https://github.com/swiftlang/swift-syntax/pull/3390&quot;&gt;PR #3390&lt;/a&gt;), and Padmashree S S is working in sourcekit-lsp (&lt;a href=&quot;https://github.com/swiftlang/sourcekit-lsp/pull/2698&quot;&gt;PR #2698&lt;/a&gt;, &lt;a href=&quot;https://github.com/swiftlang/sourcekit-lsp/pull/2729&quot;&gt;PR #2729&lt;/a&gt;).&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;Task Stealers, a new primitive in Swift Concurrency’s runtime, &lt;a href=&quot;https://github.com/swiftlang/swift/pull/86082&quot;&gt;recently merged&lt;/a&gt;&lt;/strong&gt; after generating the liveliest discussion of any PR in July. They change how work gets distributed across the cooperative thread pool, an under-the-hood change worth watching if you write concurrency-heavy code.&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;SwiftPM landed a &lt;a href=&quot;https://github.com/swiftlang/swift-package-manager/pull/10255&quot;&gt;reference implementation&lt;/a&gt; of the package registry service&lt;/strong&gt;, along with &lt;a href=&quot;https://github.com/swiftlang/swift-package-manager/pull/10258&quot;&gt;basic auth support&lt;/a&gt;, a solid starting point if you’re exploring self-hosting a registry.&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;Small but welcome fixes landed across tooling&lt;/strong&gt;: the VS Code extension now &lt;a href=&quot;https://github.com/swiftlang/vscode-swift/pull/2080&quot;&gt;fails loudly when a Swift installation is broken&lt;/a&gt;, and gained a &lt;a href=&quot;https://github.com/swiftlang/vscode-swift/pull/2280&quot;&gt;clean build folder command&lt;/a&gt;, while Swift Testing’s event stream gained an ABI.Context API that &lt;a href=&quot;https://github.com/swiftlang/swift-testing/pull/1759&quot;&gt;produces human-readable output&lt;/a&gt; for CI tooling and dashboards.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;new-package-releases&quot; class=&quot;header-with-anchor&quot;&gt;New package releases &lt;a title=&quot;Permalink for New package releases section&quot; href=&quot;#new-package-releases&quot;&gt;
            &lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt; &lt;svg width=&quot;18px&quot; height=&quot;18px&quot; viewBox=&quot;0 0 14 14&quot; role=&quot;img&quot; focusable=&quot;false&quot; aria-hidden=&quot;true&quot; xmlns=&quot;http://www.w3.org/2000/svg&quot;&gt;&lt;path d=&quot;m 11.58824,9.823529 q 0,-0.294117 -0.20589,-0.499999 L 9.85294,7.794118 q -0.20588,-0.205883 -0.5,-0.205883 -0.30882,0 -0.52941,0.235295 0.0221,0.02206 0.13971,0.136029 0.11764,0.113971 0.15808,0.158088 0.0404,0.04412 0.1103,0.139706 0.0698,0.09559 0.0956,0.1875 0.0257,0.09191 0.0257,0.202206 0,0.294117 -0.20588,0.5 -0.20588,0.205882 -0.5,0.205882 -0.1103,0 -0.20221,-0.02573 Q 8.35293,9.301471 8.25733,9.231621 8.16173,9.161771 8.11763,9.121327 8.07353,9.080887 7.95954,8.963238 7.84557,8.845591 7.82351,8.823533 7.58086,9.051474 7.58086,9.360297 q 0,0.294118 0.20588,0.5 l 1.51471,1.522059 q 0.19853,0.19853 0.5,0.19853 0.29412,0 0.5,-0.191177 l 1.08088,-1.073529 q 0.20589,-0.205883 0.20589,-0.492648 z M 6.41912,4.639706 q 0,-0.294118 -0.20588,-0.5 L 4.69853,2.617647 q -0.20588,-0.205882 -0.5,-0.205882 -0.28677,0 -0.5,0.198529 L 2.61765,3.683823 q -0.20589,0.205883 -0.20589,0.492648 0,0.294117 0.20589,0.499999 l 1.52941,1.529412 q 0.19853,0.19853 0.5,0.19853 0.30882,0 0.52941,-0.227942 Q 5.15437,6.15441 5.03676,6.040441 4.91912,5.92647 4.87868,5.882353 4.83828,5.838233 4.76838,5.742647 q -0.0698,-0.09559 -0.0956,-0.1875 -0.0257,-0.09191 -0.0257,-0.202206 0,-0.294117 0.20588,-0.5 0.20588,-0.205882 0.5,-0.205882 0.1103,0 0.20221,0.02573 0.0919,0.02573 0.1875,0.09559 0.0956,0.06985 0.1397,0.110294 0.0441,0.04044 0.15809,0.158089 Q 6.15443,5.154409 6.17649,5.176467 6.41914,4.948526 6.41914,4.639703 z M 13,9.823529 q 0,0.882353 -0.625,1.492647 l -1.08088,1.07353 Q 10.68382,13 9.80147,13 q -0.88971,0 -1.5,-0.625 L 6.78676,10.852941 Q 6.17647,10.242647 6.17647,9.360294 q 0,-0.904412 0.64706,-1.536764 L 6.17647,7.176471 Q 5.54412,7.82353 4.64706,7.82353 q -0.88235,0 -1.5,-0.617648 L 1.617647,5.676471 Q 1,5.058824 1,4.176471 1,3.294118 1.625,2.683824 L 2.70588,1.610294 Q 3.31618,1 4.19853,1 q 0.88971,0 1.5,0.625 l 1.51471,1.522059 q 0.61029,0.610294 0.61029,1.492647 0,0.904412 -0.64706,1.536764 L 7.82353,6.823529 Q 8.45588,6.17647 9.35294,6.17647 q 0.88235,0 1.5,0.617648 l 1.52941,1.529411 Q 13,8.941176 13,9.823529 z&quot;/&gt;&lt;/svg&gt;
          &lt;/a&gt;&lt;/h2&gt;
&lt;ul&gt;
  &lt;li&gt;Need to tokenize text fast? &lt;a href=&quot;https://github.com/1amageek/swift-gigatoken&quot;&gt;swift-gigatoken&lt;/a&gt; is a zero-copy tokenizer hitting up to 670 MB/s, inspired by Marcel Roed’s gigatoken, with NEON/CRC32 support and compatibility across WebAssembly and Embedded Swift.&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://github.com/MFB-Technologies-Inc/any-error-swift&quot;&gt;any-error-swift&lt;/a&gt; takes a different approach to error handling, offering a concrete, value-semantic, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Hashable&lt;/code&gt; type that erases any Swift error, no Foundation required, and works on every platform Swift runs on.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;swift-evolution&quot; class=&quot;header-with-anchor&quot;&gt;Swift Evolution &lt;a title=&quot;Permalink for Swift Evolution section&quot; href=&quot;#swift-evolution&quot;&gt;
            &lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt; &lt;svg width=&quot;18px&quot; height=&quot;18px&quot; viewBox=&quot;0 0 14 14&quot; role=&quot;img&quot; focusable=&quot;false&quot; aria-hidden=&quot;true&quot; xmlns=&quot;http://www.w3.org/2000/svg&quot;&gt;&lt;path d=&quot;m 11.58824,9.823529 q 0,-0.294117 -0.20589,-0.499999 L 9.85294,7.794118 q -0.20588,-0.205883 -0.5,-0.205883 -0.30882,0 -0.52941,0.235295 0.0221,0.02206 0.13971,0.136029 0.11764,0.113971 0.15808,0.158088 0.0404,0.04412 0.1103,0.139706 0.0698,0.09559 0.0956,0.1875 0.0257,0.09191 0.0257,0.202206 0,0.294117 -0.20588,0.5 -0.20588,0.205882 -0.5,0.205882 -0.1103,0 -0.20221,-0.02573 Q 8.35293,9.301471 8.25733,9.231621 8.16173,9.161771 8.11763,9.121327 8.07353,9.080887 7.95954,8.963238 7.84557,8.845591 7.82351,8.823533 7.58086,9.051474 7.58086,9.360297 q 0,0.294118 0.20588,0.5 l 1.51471,1.522059 q 0.19853,0.19853 0.5,0.19853 0.29412,0 0.5,-0.191177 l 1.08088,-1.073529 q 0.20589,-0.205883 0.20589,-0.492648 z M 6.41912,4.639706 q 0,-0.294118 -0.20588,-0.5 L 4.69853,2.617647 q -0.20588,-0.205882 -0.5,-0.205882 -0.28677,0 -0.5,0.198529 L 2.61765,3.683823 q -0.20589,0.205883 -0.20589,0.492648 0,0.294117 0.20589,0.499999 l 1.52941,1.529412 q 0.19853,0.19853 0.5,0.19853 0.30882,0 0.52941,-0.227942 Q 5.15437,6.15441 5.03676,6.040441 4.91912,5.92647 4.87868,5.882353 4.83828,5.838233 4.76838,5.742647 q -0.0698,-0.09559 -0.0956,-0.1875 -0.0257,-0.09191 -0.0257,-0.202206 0,-0.294117 0.20588,-0.5 0.20588,-0.205882 0.5,-0.205882 0.1103,0 0.20221,0.02573 0.0919,0.02573 0.1875,0.09559 0.0956,0.06985 0.1397,0.110294 0.0441,0.04044 0.15809,0.158089 Q 6.15443,5.154409 6.17649,5.176467 6.41914,4.948526 6.41914,4.639703 z M 13,9.823529 q 0,0.882353 -0.625,1.492647 l -1.08088,1.07353 Q 10.68382,13 9.80147,13 q -0.88971,0 -1.5,-0.625 L 6.78676,10.852941 Q 6.17647,10.242647 6.17647,9.360294 q 0,-0.904412 0.64706,-1.536764 L 6.17647,7.176471 Q 5.54412,7.82353 4.64706,7.82353 q -0.88235,0 -1.5,-0.617648 L 1.617647,5.676471 Q 1,5.058824 1,4.176471 1,3.294118 1.625,2.683824 L 2.70588,1.610294 Q 3.31618,1 4.19853,1 q 0.88971,0 1.5,0.625 l 1.51471,1.522059 q 0.61029,0.610294 0.61029,1.492647 0,0.904412 -0.64706,1.536764 L 7.82353,6.823529 Q 8.45588,6.17647 9.35294,6.17647 q 0.88235,0 1.5,0.617648 l 1.52941,1.529411 Q 13,8.941176 13,9.823529 z&quot;/&gt;&lt;/svg&gt;
          &lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;The Swift project adds new features through the &lt;a href=&quot;/swift-evolution/&quot;&gt;Swift Evolution process&lt;/a&gt;. These are some of the proposals recently accepted for a future Swift release.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Recently accepted:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;&lt;a href=&quot;https://github.com/swiftlang/swift-evolution/blob/main/proposals/testing/0025-tag-based-test-execution-filtering.md&quot;&gt;ST-0025&lt;/a&gt; Tag-based Test Execution Filtering - Swift Testing lets you annotate tests with named tags, and separately lets you include or exclude tests by regex using the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;--filter&lt;/code&gt; and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;--skip&lt;/code&gt; options, but there’s no way to combine the two and filter by tag. This proposal adds a &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;tag:&lt;/code&gt; prefix to those options, so you can run commands like &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;swift test --skip tag:uiTest&lt;/code&gt; to selectively run or skip tests based on their tags rather than relying on a consistent naming scheme.&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://github.com/swiftlang/swift-evolution/blob/main/proposals/0513-commandline-executablepath.md&quot;&gt;SE-0513&lt;/a&gt; API to get the path to the current executable - There’s currently no portable, reliable way to get the path to the currently running executable in Swift. This proposal adds &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;CommandLine.executablePath&lt;/code&gt;, a new property in the standard library that provides a consistent way to get this value across all platforms Swift supports.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Recently accepted with modifications:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;&lt;a href=&quot;https://github.com/swiftlang/swift-evolution/blob/main/proposals/0526-deadline.md&quot;&gt;SE-0526&lt;/a&gt; &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;withDeadline&lt;/code&gt; - Asynchronous operations in Swift can run indefinitely, and implementing time limits manually using task groups and clock sleep operations is verbose and error-prone. This proposal adds withDeadline, a function that executes an async operation with a composable absolute time limit specified as a clock instant, canceling the operation if it hasn’t completed in time. It also allows multiple nested operations to share the same deadline, avoiding the drift that accumulates when relative durations are passed through call layers.&lt;/li&gt;
&lt;/ul&gt;
</content>
  </entry>
  
  <entry>
    <title>What's new in Swift: June 2026 Edition</title>
    
      
        
        <author>
        
          <name>Mikaela Caron</name>
        
        </author>
      
        
        <author>
        
          <name>Adrian Eves</name>
        
        </author>
      
        
        <author>
        
          <name>Dave Lester</name>
        
        </author>
      
    
    <link href="https://swift.org/blog/whats-new-in-swift-june-2026/"/>
    <updated>2026-07-02T12:00:00-04:00</updated>
    <id>https://swift.org/blog/whats-new-in-swift-june-2026/</id>
    <content type="html">&lt;p&gt;Welcome to “What’s new in Swift,” a curated digest of releases, videos, and discussions in the Swift project and community.&lt;/p&gt;

&lt;p&gt;June was an exciting month for Swift, featuring announcements at WWDC and community events around the globe. We invited the organizers of one of them to share with us:&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;Hey, it’s Mikaela and Adrian. We are organizers of &lt;a href=&quot;https://communitykit.social&quot;&gt;CommunityKit&lt;/a&gt;, a community-organized conference that takes place the same week as WWDC, and &lt;a href=&quot;https://links.iosdevhappyhour.com&quot;&gt;iOSDevHappyHour&lt;/a&gt;, a monthly online meetup that keeps the community connected year-round. This is our fifth year coming out to Cupertino, and we love being able to create a place for the community to thrive, no matter where developers live.&lt;/p&gt;

  &lt;p&gt;CommunityKit brought together over 250 developers in real life to geek out over the announcements, stay for the community and vibes, see what everyone is creating, and learn from each other. Some of the highlights from this year’s event were the Indie Fair, where developers showcased their apps; the Watch Party, our annual gathering to watch the keynotes together; and Make Something, Ship Nothing, a hands-on postcard-making hangout to close the week. This year we also introduced workshops, including “Inclusive by Design” by Danielle Lewis, and for the Swift community: “Write Faster, Smarter Swift” by Paul Hudson.&lt;/p&gt;

  &lt;p&gt;We can’t wait to hear about what everyone builds and brings to next year’s Indie Fair, and hope to see you at CommunityKit and iOSDevHappyHour!&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Now on to other news about Swift:&lt;/p&gt;

&lt;h2 id=&quot;wwdc26-highlights&quot; class=&quot;header-with-anchor&quot;&gt;WWDC26 highlights &lt;a title=&quot;Permalink for WWDC26 highlights section&quot; href=&quot;#wwdc26-highlights&quot;&gt;
            &lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt; &lt;svg width=&quot;18px&quot; height=&quot;18px&quot; viewBox=&quot;0 0 14 14&quot; role=&quot;img&quot; focusable=&quot;false&quot; aria-hidden=&quot;true&quot; xmlns=&quot;http://www.w3.org/2000/svg&quot;&gt;&lt;path d=&quot;m 11.58824,9.823529 q 0,-0.294117 -0.20589,-0.499999 L 9.85294,7.794118 q -0.20588,-0.205883 -0.5,-0.205883 -0.30882,0 -0.52941,0.235295 0.0221,0.02206 0.13971,0.136029 0.11764,0.113971 0.15808,0.158088 0.0404,0.04412 0.1103,0.139706 0.0698,0.09559 0.0956,0.1875 0.0257,0.09191 0.0257,0.202206 0,0.294117 -0.20588,0.5 -0.20588,0.205882 -0.5,0.205882 -0.1103,0 -0.20221,-0.02573 Q 8.35293,9.301471 8.25733,9.231621 8.16173,9.161771 8.11763,9.121327 8.07353,9.080887 7.95954,8.963238 7.84557,8.845591 7.82351,8.823533 7.58086,9.051474 7.58086,9.360297 q 0,0.294118 0.20588,0.5 l 1.51471,1.522059 q 0.19853,0.19853 0.5,0.19853 0.29412,0 0.5,-0.191177 l 1.08088,-1.073529 q 0.20589,-0.205883 0.20589,-0.492648 z M 6.41912,4.639706 q 0,-0.294118 -0.20588,-0.5 L 4.69853,2.617647 q -0.20588,-0.205882 -0.5,-0.205882 -0.28677,0 -0.5,0.198529 L 2.61765,3.683823 q -0.20589,0.205883 -0.20589,0.492648 0,0.294117 0.20589,0.499999 l 1.52941,1.529412 q 0.19853,0.19853 0.5,0.19853 0.30882,0 0.52941,-0.227942 Q 5.15437,6.15441 5.03676,6.040441 4.91912,5.92647 4.87868,5.882353 4.83828,5.838233 4.76838,5.742647 q -0.0698,-0.09559 -0.0956,-0.1875 -0.0257,-0.09191 -0.0257,-0.202206 0,-0.294117 0.20588,-0.5 0.20588,-0.205882 0.5,-0.205882 0.1103,0 0.20221,0.02573 0.0919,0.02573 0.1875,0.09559 0.0956,0.06985 0.1397,0.110294 0.0441,0.04044 0.15809,0.158089 Q 6.15443,5.154409 6.17649,5.176467 6.41914,4.948526 6.41914,4.639703 z M 13,9.823529 q 0,0.882353 -0.625,1.492647 l -1.08088,1.07353 Q 10.68382,13 9.80147,13 q -0.88971,0 -1.5,-0.625 L 6.78676,10.852941 Q 6.17647,10.242647 6.17647,9.360294 q 0,-0.904412 0.64706,-1.536764 L 6.17647,7.176471 Q 5.54412,7.82353 4.64706,7.82353 q -0.88235,0 -1.5,-0.617648 L 1.617647,5.676471 Q 1,5.058824 1,4.176471 1,3.294118 1.625,2.683824 L 2.70588,1.610294 Q 3.31618,1 4.19853,1 q 0.88971,0 1.5,0.625 l 1.51471,1.522059 q 0.61029,0.610294 0.61029,1.492647 0,0.904412 -0.64706,1.536764 L 7.82353,6.823529 Q 8.45588,6.17647 9.35294,6.17647 q 0.88235,0 1.5,0.617648 l 1.52941,1.529411 Q 13,8.941176 13,9.823529 z&quot;/&gt;&lt;/svg&gt;
          &lt;/a&gt;&lt;/h2&gt;

&lt;p&gt;At its WWDC26 conference, Apple provided an update on its adoption of Swift and made a variety of new Swift-related announcements. Some highlights:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;During the &lt;a href=&quot;https://www.youtube.com/watch?v=yl2jsIoMfDU&amp;amp;t=2118s&quot;&gt;Platforms State of the Union&lt;/a&gt;, Apple announced that parts of the core operating system kernel are being written in Swift for upcoming releases.&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://www.youtube.com/watch?v=ssppiors2Ak&quot;&gt;What’s new in Swift&lt;/a&gt; featured changes in Swift since last year, including a preview of what’s coming in Swift 6.4, like up to 4x faster URL parsing and support for async code in defer blocks.&lt;/li&gt;
  &lt;li&gt;The QUIC transport layer in Apple’s networking stack was rewritten in Swift. The &lt;a href=&quot;https://github.com/apple/swift-nio-quic&quot;&gt;project has been open sourced&lt;/a&gt; and is available for cross-platform use through SwiftNIO integration.&lt;/li&gt;
  &lt;li&gt;A new Swift package, &lt;a href=&quot;https://github.com/apple/foundation-models-utilities&quot;&gt;Foundation Models framework utilities&lt;/a&gt;, was released with tools for working with LLMs, including custom skills and context management helpers. It runs on Apple platforms and select Linux distributions.&lt;/li&gt;
  &lt;li&gt;The Foundation Models framework itself will be open sourced in the future, meaning the same Swift APIs you use in your app could run on your server.&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://github.com/apple/container/blob/main/docs/container-machine.md&quot;&gt;Container Machine&lt;/a&gt; is a new tool that provides a lightweight, persistent Linux environment on a Mac. Unlike a container, which is modeled after an application, a container machine is modeled after the environment itself. Container machines share the host environment, including the home directory and configuration. It’s written in Swift and open source.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;videos-to-watch&quot; class=&quot;header-with-anchor&quot;&gt;Videos to watch &lt;a title=&quot;Permalink for Videos to watch section&quot; href=&quot;#videos-to-watch&quot;&gt;
            &lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt; &lt;svg width=&quot;18px&quot; height=&quot;18px&quot; viewBox=&quot;0 0 14 14&quot; role=&quot;img&quot; focusable=&quot;false&quot; aria-hidden=&quot;true&quot; xmlns=&quot;http://www.w3.org/2000/svg&quot;&gt;&lt;path d=&quot;m 11.58824,9.823529 q 0,-0.294117 -0.20589,-0.499999 L 9.85294,7.794118 q -0.20588,-0.205883 -0.5,-0.205883 -0.30882,0 -0.52941,0.235295 0.0221,0.02206 0.13971,0.136029 0.11764,0.113971 0.15808,0.158088 0.0404,0.04412 0.1103,0.139706 0.0698,0.09559 0.0956,0.1875 0.0257,0.09191 0.0257,0.202206 0,0.294117 -0.20588,0.5 -0.20588,0.205882 -0.5,0.205882 -0.1103,0 -0.20221,-0.02573 Q 8.35293,9.301471 8.25733,9.231621 8.16173,9.161771 8.11763,9.121327 8.07353,9.080887 7.95954,8.963238 7.84557,8.845591 7.82351,8.823533 7.58086,9.051474 7.58086,9.360297 q 0,0.294118 0.20588,0.5 l 1.51471,1.522059 q 0.19853,0.19853 0.5,0.19853 0.29412,0 0.5,-0.191177 l 1.08088,-1.073529 q 0.20589,-0.205883 0.20589,-0.492648 z M 6.41912,4.639706 q 0,-0.294118 -0.20588,-0.5 L 4.69853,2.617647 q -0.20588,-0.205882 -0.5,-0.205882 -0.28677,0 -0.5,0.198529 L 2.61765,3.683823 q -0.20589,0.205883 -0.20589,0.492648 0,0.294117 0.20589,0.499999 l 1.52941,1.529412 q 0.19853,0.19853 0.5,0.19853 0.30882,0 0.52941,-0.227942 Q 5.15437,6.15441 5.03676,6.040441 4.91912,5.92647 4.87868,5.882353 4.83828,5.838233 4.76838,5.742647 q -0.0698,-0.09559 -0.0956,-0.1875 -0.0257,-0.09191 -0.0257,-0.202206 0,-0.294117 0.20588,-0.5 0.20588,-0.205882 0.5,-0.205882 0.1103,0 0.20221,0.02573 0.0919,0.02573 0.1875,0.09559 0.0956,0.06985 0.1397,0.110294 0.0441,0.04044 0.15809,0.158089 Q 6.15443,5.154409 6.17649,5.176467 6.41914,4.948526 6.41914,4.639703 z M 13,9.823529 q 0,0.882353 -0.625,1.492647 l -1.08088,1.07353 Q 10.68382,13 9.80147,13 q -0.88971,0 -1.5,-0.625 L 6.78676,10.852941 Q 6.17647,10.242647 6.17647,9.360294 q 0,-0.904412 0.64706,-1.536764 L 6.17647,7.176471 Q 5.54412,7.82353 4.64706,7.82353 q -0.88235,0 -1.5,-0.617648 L 1.617647,5.676471 Q 1,5.058824 1,4.176471 1,3.294118 1.625,2.683824 L 2.70588,1.610294 Q 3.31618,1 4.19853,1 q 0.88971,0 1.5,0.625 l 1.51471,1.522059 q 0.61029,0.610294 0.61029,1.492647 0,0.904412 -0.64706,1.536764 L 7.82353,6.823529 Q 8.45588,6.17647 9.35294,6.17647 q 0.88235,0 1.5,0.617648 l 1.52941,1.529411 Q 13,8.941176 13,9.823529 z&quot;/&gt;&lt;/svg&gt;
          &lt;/a&gt;&lt;/h2&gt;
&lt;ul&gt;
  &lt;li&gt;&lt;a href=&quot;https://www.youtube.com/watch?v=CCFxlFF9XRI&quot;&gt;Build real-time apps and services with gRPC and Swift&lt;/a&gt; walks through integrating an iOS app and gRPC service using live race data from a go-karting league. See if you can spot where the track is located. 👀&lt;/li&gt;
  &lt;li&gt;Want to learn about Swift macros with hands-on tutorials? Stewart Lynch published two videos with sample code to follow along: &lt;a href=&quot;https://www.youtube.com/watch?v=7W6R2TIoEW8&quot;&gt;Swift Macros Demystified: Build a Freestanding Expression Macro&lt;/a&gt;, and &lt;a href=&quot;https://www.youtube.com/watch?v=iQYEG3tPWpw&quot;&gt;Swift Attached Macros: Build a Real-World Member Macro from Scratch&lt;/a&gt;.&lt;/li&gt;
  &lt;li&gt;A new &lt;a href=&quot;https://www.youtube.com/watch?v=_YwwTJ3TDpE&quot;&gt;10-minute Embedded Swift demo&lt;/a&gt; uses an accelerometer and the XIAO ESP32-C6 to control a Swift bird that glides across a mini OLED screen. No soldering required!&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;community-highlights&quot; class=&quot;header-with-anchor&quot;&gt;Community highlights &lt;a title=&quot;Permalink for Community highlights section&quot; href=&quot;#community-highlights&quot;&gt;
            &lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt; &lt;svg width=&quot;18px&quot; height=&quot;18px&quot; viewBox=&quot;0 0 14 14&quot; role=&quot;img&quot; focusable=&quot;false&quot; aria-hidden=&quot;true&quot; xmlns=&quot;http://www.w3.org/2000/svg&quot;&gt;&lt;path d=&quot;m 11.58824,9.823529 q 0,-0.294117 -0.20589,-0.499999 L 9.85294,7.794118 q -0.20588,-0.205883 -0.5,-0.205883 -0.30882,0 -0.52941,0.235295 0.0221,0.02206 0.13971,0.136029 0.11764,0.113971 0.15808,0.158088 0.0404,0.04412 0.1103,0.139706 0.0698,0.09559 0.0956,0.1875 0.0257,0.09191 0.0257,0.202206 0,0.294117 -0.20588,0.5 -0.20588,0.205882 -0.5,0.205882 -0.1103,0 -0.20221,-0.02573 Q 8.35293,9.301471 8.25733,9.231621 8.16173,9.161771 8.11763,9.121327 8.07353,9.080887 7.95954,8.963238 7.84557,8.845591 7.82351,8.823533 7.58086,9.051474 7.58086,9.360297 q 0,0.294118 0.20588,0.5 l 1.51471,1.522059 q 0.19853,0.19853 0.5,0.19853 0.29412,0 0.5,-0.191177 l 1.08088,-1.073529 q 0.20589,-0.205883 0.20589,-0.492648 z M 6.41912,4.639706 q 0,-0.294118 -0.20588,-0.5 L 4.69853,2.617647 q -0.20588,-0.205882 -0.5,-0.205882 -0.28677,0 -0.5,0.198529 L 2.61765,3.683823 q -0.20589,0.205883 -0.20589,0.492648 0,0.294117 0.20589,0.499999 l 1.52941,1.529412 q 0.19853,0.19853 0.5,0.19853 0.30882,0 0.52941,-0.227942 Q 5.15437,6.15441 5.03676,6.040441 4.91912,5.92647 4.87868,5.882353 4.83828,5.838233 4.76838,5.742647 q -0.0698,-0.09559 -0.0956,-0.1875 -0.0257,-0.09191 -0.0257,-0.202206 0,-0.294117 0.20588,-0.5 0.20588,-0.205882 0.5,-0.205882 0.1103,0 0.20221,0.02573 0.0919,0.02573 0.1875,0.09559 0.0956,0.06985 0.1397,0.110294 0.0441,0.04044 0.15809,0.158089 Q 6.15443,5.154409 6.17649,5.176467 6.41914,4.948526 6.41914,4.639703 z M 13,9.823529 q 0,0.882353 -0.625,1.492647 l -1.08088,1.07353 Q 10.68382,13 9.80147,13 q -0.88971,0 -1.5,-0.625 L 6.78676,10.852941 Q 6.17647,10.242647 6.17647,9.360294 q 0,-0.904412 0.64706,-1.536764 L 6.17647,7.176471 Q 5.54412,7.82353 4.64706,7.82353 q -0.88235,0 -1.5,-0.617648 L 1.617647,5.676471 Q 1,5.058824 1,4.176471 1,3.294118 1.625,2.683824 L 2.70588,1.610294 Q 3.31618,1 4.19853,1 q 0.88971,0 1.5,0.625 l 1.51471,1.522059 q 0.61029,0.610294 0.61029,1.492647 0,0.904412 -0.64706,1.536764 L 7.82353,6.823529 Q 8.45588,6.17647 9.35294,6.17647 q 0.88235,0 1.5,0.617648 l 1.52941,1.529411 Q 13,8.941176 13,9.823529 z&quot;/&gt;&lt;/svg&gt;
          &lt;/a&gt;&lt;/h2&gt;
&lt;ul&gt;
  &lt;li&gt;&lt;a href=&quot;https://swiftpackageindex.com/blog/swift-package-index-joins-apple&quot;&gt;Swift Package Index joined Apple&lt;/a&gt; and remains open source. The team says they’re working together to build a comprehensive package registry for the Swift community.&lt;/li&gt;
  &lt;li&gt;Yeo Kheng Meng blogged about &lt;a href=&quot;https://yeokhengmeng.com/2026/06/swift-on-apple-ii/&quot;&gt;bringing Swift to the Apple II&lt;/a&gt;, complete with a REPL, compiler, file browser, and editor. It’s a subset of Swift and was built with AI assistance.&lt;/li&gt;
  &lt;li&gt;Apple shared an adoption story on the Swift blog: &lt;a href=&quot;https://www.swift.org/blog/migrating-truetype-hinting-to-swift/&quot;&gt;Migrating the TrueType Hinting Interpreter&lt;/a&gt;, covering how the TrueType hinting interpreter in macOS and iOS was rewritten in Swift from C. It runs 13% faster on average.&lt;/li&gt;
  &lt;li&gt;The Swift Ecosystem Steering Group &lt;a href=&quot;https://www.swift.org/blog/announcing-networking-workgroup/&quot;&gt;announced the creation of the Networking workgroup&lt;/a&gt;. This group will work on a unified networking stack for Swift, layered from low-level I/O primitives, through common protocols, to a modern HTTP client and server API.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;new-package-releases&quot; class=&quot;header-with-anchor&quot;&gt;New package releases &lt;a title=&quot;Permalink for New package releases section&quot; href=&quot;#new-package-releases&quot;&gt;
            &lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt; &lt;svg width=&quot;18px&quot; height=&quot;18px&quot; viewBox=&quot;0 0 14 14&quot; role=&quot;img&quot; focusable=&quot;false&quot; aria-hidden=&quot;true&quot; xmlns=&quot;http://www.w3.org/2000/svg&quot;&gt;&lt;path d=&quot;m 11.58824,9.823529 q 0,-0.294117 -0.20589,-0.499999 L 9.85294,7.794118 q -0.20588,-0.205883 -0.5,-0.205883 -0.30882,0 -0.52941,0.235295 0.0221,0.02206 0.13971,0.136029 0.11764,0.113971 0.15808,0.158088 0.0404,0.04412 0.1103,0.139706 0.0698,0.09559 0.0956,0.1875 0.0257,0.09191 0.0257,0.202206 0,0.294117 -0.20588,0.5 -0.20588,0.205882 -0.5,0.205882 -0.1103,0 -0.20221,-0.02573 Q 8.35293,9.301471 8.25733,9.231621 8.16173,9.161771 8.11763,9.121327 8.07353,9.080887 7.95954,8.963238 7.84557,8.845591 7.82351,8.823533 7.58086,9.051474 7.58086,9.360297 q 0,0.294118 0.20588,0.5 l 1.51471,1.522059 q 0.19853,0.19853 0.5,0.19853 0.29412,0 0.5,-0.191177 l 1.08088,-1.073529 q 0.20589,-0.205883 0.20589,-0.492648 z M 6.41912,4.639706 q 0,-0.294118 -0.20588,-0.5 L 4.69853,2.617647 q -0.20588,-0.205882 -0.5,-0.205882 -0.28677,0 -0.5,0.198529 L 2.61765,3.683823 q -0.20589,0.205883 -0.20589,0.492648 0,0.294117 0.20589,0.499999 l 1.52941,1.529412 q 0.19853,0.19853 0.5,0.19853 0.30882,0 0.52941,-0.227942 Q 5.15437,6.15441 5.03676,6.040441 4.91912,5.92647 4.87868,5.882353 4.83828,5.838233 4.76838,5.742647 q -0.0698,-0.09559 -0.0956,-0.1875 -0.0257,-0.09191 -0.0257,-0.202206 0,-0.294117 0.20588,-0.5 0.20588,-0.205882 0.5,-0.205882 0.1103,0 0.20221,0.02573 0.0919,0.02573 0.1875,0.09559 0.0956,0.06985 0.1397,0.110294 0.0441,0.04044 0.15809,0.158089 Q 6.15443,5.154409 6.17649,5.176467 6.41914,4.948526 6.41914,4.639703 z M 13,9.823529 q 0,0.882353 -0.625,1.492647 l -1.08088,1.07353 Q 10.68382,13 9.80147,13 q -0.88971,0 -1.5,-0.625 L 6.78676,10.852941 Q 6.17647,10.242647 6.17647,9.360294 q 0,-0.904412 0.64706,-1.536764 L 6.17647,7.176471 Q 5.54412,7.82353 4.64706,7.82353 q -0.88235,0 -1.5,-0.617648 L 1.617647,5.676471 Q 1,5.058824 1,4.176471 1,3.294118 1.625,2.683824 L 2.70588,1.610294 Q 3.31618,1 4.19853,1 q 0.88971,0 1.5,0.625 l 1.51471,1.522059 q 0.61029,0.610294 0.61029,1.492647 0,0.904412 -0.64706,1.536764 L 7.82353,6.823529 Q 8.45588,6.17647 9.35294,6.17647 q 0.88235,0 1.5,0.617648 l 1.52941,1.529411 Q 13,8.941176 13,9.823529 z&quot;/&gt;&lt;/svg&gt;
          &lt;/a&gt;&lt;/h2&gt;
&lt;ul&gt;
  &lt;li&gt;New &lt;a href=&quot;https://forums.swift.org/t/swift-okhttp-swift-bindings-for-okhttp-on-android-java/87128&quot;&gt;Swift bindings for the OkHttp Java library&lt;/a&gt; were released. If you’re using Swift on Android and looking for an HTTP client this may be useful. The project was generated with &lt;a href=&quot;https://github.com/swiftlang/swift-java&quot;&gt;swift-java&lt;/a&gt;.&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://forums.swift.org/t/kiln-a-documentation-engine-written-in-swift/87287&quot;&gt;Kiln&lt;/a&gt; is a new documentation engine written in Swift. Built to replace MkDocs-based documentation sites, it gives more options for the Swift community to render docs, in addition to the &lt;a href=&quot;https://www.swift.org/documentation/docc/&quot;&gt;DocC&lt;/a&gt; project which is used for the official Swift documentation. You can see Kiln in action at the &lt;a href=&quot;https://docs.vapor.codes&quot;&gt;Vapor documentation&lt;/a&gt;.&lt;/li&gt;
  &lt;li&gt;Version 0.4.0 of &lt;a href=&quot;https://github.com/elementary-swift/elementary-ui&quot;&gt;Elementary UI&lt;/a&gt; was released, a frontend framework for running Swift applications natively in the browser.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;swift-evolution&quot; class=&quot;header-with-anchor&quot;&gt;Swift Evolution &lt;a title=&quot;Permalink for Swift Evolution section&quot; href=&quot;#swift-evolution&quot;&gt;
            &lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt; &lt;svg width=&quot;18px&quot; height=&quot;18px&quot; viewBox=&quot;0 0 14 14&quot; role=&quot;img&quot; focusable=&quot;false&quot; aria-hidden=&quot;true&quot; xmlns=&quot;http://www.w3.org/2000/svg&quot;&gt;&lt;path d=&quot;m 11.58824,9.823529 q 0,-0.294117 -0.20589,-0.499999 L 9.85294,7.794118 q -0.20588,-0.205883 -0.5,-0.205883 -0.30882,0 -0.52941,0.235295 0.0221,0.02206 0.13971,0.136029 0.11764,0.113971 0.15808,0.158088 0.0404,0.04412 0.1103,0.139706 0.0698,0.09559 0.0956,0.1875 0.0257,0.09191 0.0257,0.202206 0,0.294117 -0.20588,0.5 -0.20588,0.205882 -0.5,0.205882 -0.1103,0 -0.20221,-0.02573 Q 8.35293,9.301471 8.25733,9.231621 8.16173,9.161771 8.11763,9.121327 8.07353,9.080887 7.95954,8.963238 7.84557,8.845591 7.82351,8.823533 7.58086,9.051474 7.58086,9.360297 q 0,0.294118 0.20588,0.5 l 1.51471,1.522059 q 0.19853,0.19853 0.5,0.19853 0.29412,0 0.5,-0.191177 l 1.08088,-1.073529 q 0.20589,-0.205883 0.20589,-0.492648 z M 6.41912,4.639706 q 0,-0.294118 -0.20588,-0.5 L 4.69853,2.617647 q -0.20588,-0.205882 -0.5,-0.205882 -0.28677,0 -0.5,0.198529 L 2.61765,3.683823 q -0.20589,0.205883 -0.20589,0.492648 0,0.294117 0.20589,0.499999 l 1.52941,1.529412 q 0.19853,0.19853 0.5,0.19853 0.30882,0 0.52941,-0.227942 Q 5.15437,6.15441 5.03676,6.040441 4.91912,5.92647 4.87868,5.882353 4.83828,5.838233 4.76838,5.742647 q -0.0698,-0.09559 -0.0956,-0.1875 -0.0257,-0.09191 -0.0257,-0.202206 0,-0.294117 0.20588,-0.5 0.20588,-0.205882 0.5,-0.205882 0.1103,0 0.20221,0.02573 0.0919,0.02573 0.1875,0.09559 0.0956,0.06985 0.1397,0.110294 0.0441,0.04044 0.15809,0.158089 Q 6.15443,5.154409 6.17649,5.176467 6.41914,4.948526 6.41914,4.639703 z M 13,9.823529 q 0,0.882353 -0.625,1.492647 l -1.08088,1.07353 Q 10.68382,13 9.80147,13 q -0.88971,0 -1.5,-0.625 L 6.78676,10.852941 Q 6.17647,10.242647 6.17647,9.360294 q 0,-0.904412 0.64706,-1.536764 L 6.17647,7.176471 Q 5.54412,7.82353 4.64706,7.82353 q -0.88235,0 -1.5,-0.617648 L 1.617647,5.676471 Q 1,5.058824 1,4.176471 1,3.294118 1.625,2.683824 L 2.70588,1.610294 Q 3.31618,1 4.19853,1 q 0.88971,0 1.5,0.625 l 1.51471,1.522059 q 0.61029,0.610294 0.61029,1.492647 0,0.904412 -0.64706,1.536764 L 7.82353,6.823529 Q 8.45588,6.17647 9.35294,6.17647 q 0.88235,0 1.5,0.617648 l 1.52941,1.529411 Q 13,8.941176 13,9.823529 z&quot;/&gt;&lt;/svg&gt;
          &lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;The Swift project adds new language features through the &lt;a href=&quot;https://www.swift.org/swift-evolution/&quot;&gt;Swift Evolution process&lt;/a&gt;. These are some of the proposals currently under review or recently accepted for a future Swift release.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Under active review:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;&lt;a href=&quot;https://github.com/swiftlang/swift-evolution/blob/main/proposals/0526-deadline.md&quot;&gt;SE-0526&lt;/a&gt; &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;withDeadline&lt;/code&gt; - Asynchronous operations in Swift can run indefinitely, and implementing time limits manually using task groups and clock sleep operations is verbose and error-prone. This proposal adds &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;withDeadline&lt;/code&gt;, a function that executes an async operation with a composable absolute time limit specified as a clock instant, canceling the operation if it hasn’t completed in time. It also allows multiple nested operations to share the same deadline, avoiding the drift that accumulates when relative durations are passed through call layers.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Recently accepted:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;&lt;a href=&quot;https://github.com/swiftlang/swift-evolution/blob/main/proposals/0474-yielding-accessors.md&quot;&gt;SE-0474&lt;/a&gt; Yielding Accessors - When you call a mutating method on a computed property, Swift creates the illusion of in-place mutation by getting a copy, mutating it, then setting it back. This causes unnecessary copy-on-write buffer duplication for types like &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;String&lt;/code&gt;, and is impossible for noncopyable types, which can’t be copied out at all. This proposal adds &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;yielding borrow&lt;/code&gt; and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;yielding mutate&lt;/code&gt;, two new ways to implement computed properties and subscripts that instead lend the caller direct access to the underlying value without copying it.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Recently accepted with modifications:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;&lt;a href=&quot;https://github.com/swiftlang/swift-evolution/blob/main/proposals/0529-filepath-in-stdlib.md&quot;&gt;SE-0529&lt;/a&gt; Add &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;FilePath&lt;/code&gt; to the Standard Library - &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;FilePath&lt;/code&gt; in the swift-system package parses platform-specific path syntax on the developer’s behalf, provides a normalized view of path components, and enables filesystem resolution. However, shipping in an external package means the standard library, Swift runtime, and toolchain libraries such as Foundation cannot depend on it. This proposal adds &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;FilePath&lt;/code&gt; and its associated types to the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Swift&lt;/code&gt; module, alongside essential functionality for construction, decomposition, resolution, and C interoperability.&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://github.com/swiftlang/swift-evolution/blob/main/proposals/0527-rigidarray-uniquearray.md&quot;&gt;SE-0527&lt;/a&gt; &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;UniqueArray&lt;/code&gt; - Swift’s &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Array&lt;/code&gt; can’t store noncopyable elements without compromising its copy-on-write semantics or performance predictability. This proposal adds two new types to a new Containers module: &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;RigidArray&lt;/code&gt;, a fixed-capacity array that traps on overflow, and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;UniqueArray&lt;/code&gt;, a dynamically growing array that enforces unique ownership by being noncopyable itself.&lt;/li&gt;
&lt;/ul&gt;
</content>
  </entry>
  
  <entry>
    <title>Swift Package Index Update</title>
    
      
        
        <author>
        
          <name>Dave Lester</name>
        
        </author>
      
    
    <link href="https://swift.org/blog/swift-package-index-update/"/>
    <updated>2026-06-23T10:00:00-04:00</updated>
    <id>https://swift.org/blog/swift-package-index-update/</id>
    <content type="html">&lt;p&gt;Since its launch, &lt;a href=&quot;https://swiftpackageindex.com&quot;&gt;Swift Package Index&lt;/a&gt; has become an essential part of the Swift ecosystem, helping developers discover quality packages, evaluate compatibility, and make informed decisions about dependencies.&lt;/p&gt;

&lt;p&gt;Started by Dave Verwer and Sven A. Schmidt, the project currently indexes thousands of packages and serves as a central hub for package documentation. Recently, Swift Package Index has grown alongside the Swift project’s multi-platform expansion, extending its compatibility testing to encompass Linux, Android, and WebAssembly.&lt;/p&gt;

&lt;p&gt;Today, Swift Package Index announced that it has joined Apple and continues its mission:&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;Together, we’re building a comprehensive package registry to serve the Swift community’s evolving needs.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Learn more by reading the &lt;a href=&quot;https://swiftpackageindex.com/blog/swift-package-index-joins-apple&quot;&gt;Swift Package Index announcement&lt;/a&gt;.&lt;/p&gt;
</content>
  </entry>
  
  <entry>
    <title>Swift at Apple: Migrating the TrueType Hinting Interpreter</title>
    
      
        
        <author>
        
          <name>Scott Perry</name>
        
        </author>
      
    
    <link href="https://swift.org/blog/migrating-truetype-hinting-to-swift/"/>
    <updated>2026-06-12T06:00:00-04:00</updated>
    <id>https://swift.org/blog/migrating-truetype-hinting-to-swift/</id>
    <content type="html">&lt;p&gt;TrueType is a widely used vector font standard for rendering text in web pages, PDFs, operating systems, and applications. Familiar fonts like Helvetica, Garamond, and Monaco are all built on TrueType outlines. The format specifies a &lt;a href=&quot;https://developer.apple.com/fonts/TrueType-Reference-Manual/RM02/Chap2.html#environment&quot;&gt;hinting interpreter&lt;/a&gt; intended to help outlines rasterize faithfully on low-resolution displays. Modern high-resolution displays enable beautiful typography from outlines alone, but TrueType fonts that need hinting to render legibly remain in use and we continue to support them.&lt;/p&gt;

&lt;p&gt;Font parsers process data from untrusted sources, making the TrueType hinting interpreter a security-critical attack surface. To make the format more resilient on Apple platforms, we rewrote its hinting interpreter from C to &lt;a href=&quot;https://docs.swift.org/compiler/documentation/diagnostics/strict-memory-safety/&quot;&gt;memory-safe&lt;/a&gt; Swift for the Fall 2025 releases. In addition to memory safety, we also improved performance: on average, our Swift interpreter runs 13% faster than the C interpreter it replaced.&lt;/p&gt;

&lt;p&gt;To accompany this post, we’ve also published the source code of &lt;a href=&quot;https://github.com/apple/truetype-hinting-interpreter-example&quot;&gt;the Swift TrueType hinting interpreter&lt;/a&gt;. We hope sharing our experience helps others doing similar work in Swift.&lt;/p&gt;

&lt;!--read more--&gt;

&lt;h2 id=&quot;truetype-and-the-hinting-engine&quot; class=&quot;header-with-anchor&quot;&gt;TrueType and the hinting engine &lt;a title=&quot;Permalink for TrueType and the hinting engine section&quot; href=&quot;#truetype-and-the-hinting-engine&quot;&gt;
            &lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt; &lt;svg width=&quot;18px&quot; height=&quot;18px&quot; viewBox=&quot;0 0 14 14&quot; role=&quot;img&quot; focusable=&quot;false&quot; aria-hidden=&quot;true&quot; xmlns=&quot;http://www.w3.org/2000/svg&quot;&gt;&lt;path d=&quot;m 11.58824,9.823529 q 0,-0.294117 -0.20589,-0.499999 L 9.85294,7.794118 q -0.20588,-0.205883 -0.5,-0.205883 -0.30882,0 -0.52941,0.235295 0.0221,0.02206 0.13971,0.136029 0.11764,0.113971 0.15808,0.158088 0.0404,0.04412 0.1103,0.139706 0.0698,0.09559 0.0956,0.1875 0.0257,0.09191 0.0257,0.202206 0,0.294117 -0.20588,0.5 -0.20588,0.205882 -0.5,0.205882 -0.1103,0 -0.20221,-0.02573 Q 8.35293,9.301471 8.25733,9.231621 8.16173,9.161771 8.11763,9.121327 8.07353,9.080887 7.95954,8.963238 7.84557,8.845591 7.82351,8.823533 7.58086,9.051474 7.58086,9.360297 q 0,0.294118 0.20588,0.5 l 1.51471,1.522059 q 0.19853,0.19853 0.5,0.19853 0.29412,0 0.5,-0.191177 l 1.08088,-1.073529 q 0.20589,-0.205883 0.20589,-0.492648 z M 6.41912,4.639706 q 0,-0.294118 -0.20588,-0.5 L 4.69853,2.617647 q -0.20588,-0.205882 -0.5,-0.205882 -0.28677,0 -0.5,0.198529 L 2.61765,3.683823 q -0.20589,0.205883 -0.20589,0.492648 0,0.294117 0.20589,0.499999 l 1.52941,1.529412 q 0.19853,0.19853 0.5,0.19853 0.30882,0 0.52941,-0.227942 Q 5.15437,6.15441 5.03676,6.040441 4.91912,5.92647 4.87868,5.882353 4.83828,5.838233 4.76838,5.742647 q -0.0698,-0.09559 -0.0956,-0.1875 -0.0257,-0.09191 -0.0257,-0.202206 0,-0.294117 0.20588,-0.5 0.20588,-0.205882 0.5,-0.205882 0.1103,0 0.20221,0.02573 0.0919,0.02573 0.1875,0.09559 0.0956,0.06985 0.1397,0.110294 0.0441,0.04044 0.15809,0.158089 Q 6.15443,5.154409 6.17649,5.176467 6.41914,4.948526 6.41914,4.639703 z M 13,9.823529 q 0,0.882353 -0.625,1.492647 l -1.08088,1.07353 Q 10.68382,13 9.80147,13 q -0.88971,0 -1.5,-0.625 L 6.78676,10.852941 Q 6.17647,10.242647 6.17647,9.360294 q 0,-0.904412 0.64706,-1.536764 L 6.17647,7.176471 Q 5.54412,7.82353 4.64706,7.82353 q -0.88235,0 -1.5,-0.617648 L 1.617647,5.676471 Q 1,5.058824 1,4.176471 1,3.294118 1.625,2.683824 L 2.70588,1.610294 Q 3.31618,1 4.19853,1 q 0.88971,0 1.5,0.625 l 1.51471,1.522059 q 0.61029,0.610294 0.61029,1.492647 0,0.904412 -0.64706,1.536764 L 7.82353,6.823529 Q 8.45588,6.17647 9.35294,6.17647 q 0.88235,0 1.5,0.617648 l 1.52941,1.529411 Q 13,8.941176 13,9.823529 z&quot;/&gt;&lt;/svg&gt;
          &lt;/a&gt;&lt;/h2&gt;

&lt;p&gt;Apple developed TrueType in the late 1980s and released it with the launch of System 7 in 1991. TrueType was a major breakthrough for the time: it gave font developers enormous control over how glyphs are displayed, with an advanced grid-fitting algorithm and a sophisticated hinting engine built around a special-purpose bytecode interpreter. TrueType did all this on computers that were vastly less powerful than today’s, so it had to be extremely well-tuned for performance.&lt;/p&gt;

&lt;p&gt;Then the internet revolutionized how fonts were used. TrueType became embeddable in PDF files in 1994 and in web pages in 2008, and it remains as relevant as ever. However, these new use cases brought additional risk: TrueType could now be exposed to untrusted fonts from anywhere on the internet.&lt;/p&gt;

&lt;p&gt;TrueType fonts may contain programs the hinting engine runs through a bytecode interpreter. This interpreter involves input-driven control flow, complex data structures, and careful memory management—exactly the kind of code that’s hard to make perfect and where memory errors are easier to exploit. This high inherent complexity also makes correctness especially important.&lt;/p&gt;

&lt;h2 id=&quot;rewriting-in-swift&quot; class=&quot;header-with-anchor&quot;&gt;Rewriting in Swift &lt;a title=&quot;Permalink for Rewriting in Swift section&quot; href=&quot;#rewriting-in-swift&quot;&gt;
            &lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt; &lt;svg width=&quot;18px&quot; height=&quot;18px&quot; viewBox=&quot;0 0 14 14&quot; role=&quot;img&quot; focusable=&quot;false&quot; aria-hidden=&quot;true&quot; xmlns=&quot;http://www.w3.org/2000/svg&quot;&gt;&lt;path d=&quot;m 11.58824,9.823529 q 0,-0.294117 -0.20589,-0.499999 L 9.85294,7.794118 q -0.20588,-0.205883 -0.5,-0.205883 -0.30882,0 -0.52941,0.235295 0.0221,0.02206 0.13971,0.136029 0.11764,0.113971 0.15808,0.158088 0.0404,0.04412 0.1103,0.139706 0.0698,0.09559 0.0956,0.1875 0.0257,0.09191 0.0257,0.202206 0,0.294117 -0.20588,0.5 -0.20588,0.205882 -0.5,0.205882 -0.1103,0 -0.20221,-0.02573 Q 8.35293,9.301471 8.25733,9.231621 8.16173,9.161771 8.11763,9.121327 8.07353,9.080887 7.95954,8.963238 7.84557,8.845591 7.82351,8.823533 7.58086,9.051474 7.58086,9.360297 q 0,0.294118 0.20588,0.5 l 1.51471,1.522059 q 0.19853,0.19853 0.5,0.19853 0.29412,0 0.5,-0.191177 l 1.08088,-1.073529 q 0.20589,-0.205883 0.20589,-0.492648 z M 6.41912,4.639706 q 0,-0.294118 -0.20588,-0.5 L 4.69853,2.617647 q -0.20588,-0.205882 -0.5,-0.205882 -0.28677,0 -0.5,0.198529 L 2.61765,3.683823 q -0.20589,0.205883 -0.20589,0.492648 0,0.294117 0.20589,0.499999 l 1.52941,1.529412 q 0.19853,0.19853 0.5,0.19853 0.30882,0 0.52941,-0.227942 Q 5.15437,6.15441 5.03676,6.040441 4.91912,5.92647 4.87868,5.882353 4.83828,5.838233 4.76838,5.742647 q -0.0698,-0.09559 -0.0956,-0.1875 -0.0257,-0.09191 -0.0257,-0.202206 0,-0.294117 0.20588,-0.5 0.20588,-0.205882 0.5,-0.205882 0.1103,0 0.20221,0.02573 0.0919,0.02573 0.1875,0.09559 0.0956,0.06985 0.1397,0.110294 0.0441,0.04044 0.15809,0.158089 Q 6.15443,5.154409 6.17649,5.176467 6.41914,4.948526 6.41914,4.639703 z M 13,9.823529 q 0,0.882353 -0.625,1.492647 l -1.08088,1.07353 Q 10.68382,13 9.80147,13 q -0.88971,0 -1.5,-0.625 L 6.78676,10.852941 Q 6.17647,10.242647 6.17647,9.360294 q 0,-0.904412 0.64706,-1.536764 L 6.17647,7.176471 Q 5.54412,7.82353 4.64706,7.82353 q -0.88235,0 -1.5,-0.617648 L 1.617647,5.676471 Q 1,5.058824 1,4.176471 1,3.294118 1.625,2.683824 L 2.70588,1.610294 Q 3.31618,1 4.19853,1 q 0.88971,0 1.5,0.625 l 1.51471,1.522059 q 0.61029,0.610294 0.61029,1.492647 0,0.904412 -0.64706,1.536764 L 7.82353,6.823529 Q 8.45588,6.17647 9.35294,6.17647 q 0.88235,0 1.5,0.617648 l 1.52941,1.529411 Q 13,8.941176 13,9.823529 z&quot;/&gt;&lt;/svg&gt;
          &lt;/a&gt;&lt;/h2&gt;

&lt;p&gt;A rewrite required a memory-safe language that could integrate into the existing codebase and provide an equivalent level of performance to the implementation it was replacing. Swift was the obvious choice for the task.&lt;/p&gt;

&lt;p&gt;Binary compatibility was crucial for this project to succeed: existing programs had to continue to function the same as they did before, effectively unaware that a new implementation was in place. This means not just interface compatibility but pixel-identical glyph rendering as well, relative to the C implementation. Hinting can radically change the on-screen appearance of glyphs, so a small change in the interpreter’s behavior could result in substantial user-visible changes. For this project, we defined &lt;em&gt;correctness&lt;/em&gt; to mean exact compatibility with the C implementation’s outputs.&lt;/p&gt;

&lt;h2 id=&quot;validating-correctness&quot; class=&quot;header-with-anchor&quot;&gt;Validating correctness &lt;a title=&quot;Permalink for Validating correctness section&quot; href=&quot;#validating-correctness&quot;&gt;
            &lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt; &lt;svg width=&quot;18px&quot; height=&quot;18px&quot; viewBox=&quot;0 0 14 14&quot; role=&quot;img&quot; focusable=&quot;false&quot; aria-hidden=&quot;true&quot; xmlns=&quot;http://www.w3.org/2000/svg&quot;&gt;&lt;path d=&quot;m 11.58824,9.823529 q 0,-0.294117 -0.20589,-0.499999 L 9.85294,7.794118 q -0.20588,-0.205883 -0.5,-0.205883 -0.30882,0 -0.52941,0.235295 0.0221,0.02206 0.13971,0.136029 0.11764,0.113971 0.15808,0.158088 0.0404,0.04412 0.1103,0.139706 0.0698,0.09559 0.0956,0.1875 0.0257,0.09191 0.0257,0.202206 0,0.294117 -0.20588,0.5 -0.20588,0.205882 -0.5,0.205882 -0.1103,0 -0.20221,-0.02573 Q 8.35293,9.301471 8.25733,9.231621 8.16173,9.161771 8.11763,9.121327 8.07353,9.080887 7.95954,8.963238 7.84557,8.845591 7.82351,8.823533 7.58086,9.051474 7.58086,9.360297 q 0,0.294118 0.20588,0.5 l 1.51471,1.522059 q 0.19853,0.19853 0.5,0.19853 0.29412,0 0.5,-0.191177 l 1.08088,-1.073529 q 0.20589,-0.205883 0.20589,-0.492648 z M 6.41912,4.639706 q 0,-0.294118 -0.20588,-0.5 L 4.69853,2.617647 q -0.20588,-0.205882 -0.5,-0.205882 -0.28677,0 -0.5,0.198529 L 2.61765,3.683823 q -0.20589,0.205883 -0.20589,0.492648 0,0.294117 0.20589,0.499999 l 1.52941,1.529412 q 0.19853,0.19853 0.5,0.19853 0.30882,0 0.52941,-0.227942 Q 5.15437,6.15441 5.03676,6.040441 4.91912,5.92647 4.87868,5.882353 4.83828,5.838233 4.76838,5.742647 q -0.0698,-0.09559 -0.0956,-0.1875 -0.0257,-0.09191 -0.0257,-0.202206 0,-0.294117 0.20588,-0.5 0.20588,-0.205882 0.5,-0.205882 0.1103,0 0.20221,0.02573 0.0919,0.02573 0.1875,0.09559 0.0956,0.06985 0.1397,0.110294 0.0441,0.04044 0.15809,0.158089 Q 6.15443,5.154409 6.17649,5.176467 6.41914,4.948526 6.41914,4.639703 z M 13,9.823529 q 0,0.882353 -0.625,1.492647 l -1.08088,1.07353 Q 10.68382,13 9.80147,13 q -0.88971,0 -1.5,-0.625 L 6.78676,10.852941 Q 6.17647,10.242647 6.17647,9.360294 q 0,-0.904412 0.64706,-1.536764 L 6.17647,7.176471 Q 5.54412,7.82353 4.64706,7.82353 q -0.88235,0 -1.5,-0.617648 L 1.617647,5.676471 Q 1,5.058824 1,4.176471 1,3.294118 1.625,2.683824 L 2.70588,1.610294 Q 3.31618,1 4.19853,1 q 0.88971,0 1.5,0.625 l 1.51471,1.522059 q 0.61029,0.610294 0.61029,1.492647 0,0.904412 -0.64706,1.536764 L 7.82353,6.823529 Q 8.45588,6.17647 9.35294,6.17647 q 0.88235,0 1.5,0.617648 l 1.52941,1.529411 Q 13,8.941176 13,9.823529 z&quot;/&gt;&lt;/svg&gt;
          &lt;/a&gt;&lt;/h2&gt;

&lt;p&gt;To ensure correctness, we developed two test suites. The first was a unit test suite that can target both implementations, providing exhaustive (99.7%) code coverage for both. This suite is included with the open source release of the Swift interpreter.&lt;/p&gt;

&lt;p&gt;Then, to represent real-world workloads, we used a fuzzer to minimize a corpus of 10 million PDF files down to 4,200 without any loss of code coverage. The documents in the minimized corpus embedded 25,572 fonts with a total of 27 million glyphs that we rendered using four different transformations each, comparing the resulting bitmaps against the reference interpreter. This gave us confidence in the new interpreter’s compatibility.&lt;/p&gt;

&lt;p&gt;By the end of the project, we wrote nearly four times as many lines of test code as we wrote for the Swift interpreter itself.&lt;/p&gt;

&lt;h2 id=&quot;achieving-high-performance&quot; class=&quot;header-with-anchor&quot;&gt;Achieving high performance &lt;a title=&quot;Permalink for Achieving high performance section&quot; href=&quot;#achieving-high-performance&quot;&gt;
            &lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt; &lt;svg width=&quot;18px&quot; height=&quot;18px&quot; viewBox=&quot;0 0 14 14&quot; role=&quot;img&quot; focusable=&quot;false&quot; aria-hidden=&quot;true&quot; xmlns=&quot;http://www.w3.org/2000/svg&quot;&gt;&lt;path d=&quot;m 11.58824,9.823529 q 0,-0.294117 -0.20589,-0.499999 L 9.85294,7.794118 q -0.20588,-0.205883 -0.5,-0.205883 -0.30882,0 -0.52941,0.235295 0.0221,0.02206 0.13971,0.136029 0.11764,0.113971 0.15808,0.158088 0.0404,0.04412 0.1103,0.139706 0.0698,0.09559 0.0956,0.1875 0.0257,0.09191 0.0257,0.202206 0,0.294117 -0.20588,0.5 -0.20588,0.205882 -0.5,0.205882 -0.1103,0 -0.20221,-0.02573 Q 8.35293,9.301471 8.25733,9.231621 8.16173,9.161771 8.11763,9.121327 8.07353,9.080887 7.95954,8.963238 7.84557,8.845591 7.82351,8.823533 7.58086,9.051474 7.58086,9.360297 q 0,0.294118 0.20588,0.5 l 1.51471,1.522059 q 0.19853,0.19853 0.5,0.19853 0.29412,0 0.5,-0.191177 l 1.08088,-1.073529 q 0.20589,-0.205883 0.20589,-0.492648 z M 6.41912,4.639706 q 0,-0.294118 -0.20588,-0.5 L 4.69853,2.617647 q -0.20588,-0.205882 -0.5,-0.205882 -0.28677,0 -0.5,0.198529 L 2.61765,3.683823 q -0.20589,0.205883 -0.20589,0.492648 0,0.294117 0.20589,0.499999 l 1.52941,1.529412 q 0.19853,0.19853 0.5,0.19853 0.30882,0 0.52941,-0.227942 Q 5.15437,6.15441 5.03676,6.040441 4.91912,5.92647 4.87868,5.882353 4.83828,5.838233 4.76838,5.742647 q -0.0698,-0.09559 -0.0956,-0.1875 -0.0257,-0.09191 -0.0257,-0.202206 0,-0.294117 0.20588,-0.5 0.20588,-0.205882 0.5,-0.205882 0.1103,0 0.20221,0.02573 0.0919,0.02573 0.1875,0.09559 0.0956,0.06985 0.1397,0.110294 0.0441,0.04044 0.15809,0.158089 Q 6.15443,5.154409 6.17649,5.176467 6.41914,4.948526 6.41914,4.639703 z M 13,9.823529 q 0,0.882353 -0.625,1.492647 l -1.08088,1.07353 Q 10.68382,13 9.80147,13 q -0.88971,0 -1.5,-0.625 L 6.78676,10.852941 Q 6.17647,10.242647 6.17647,9.360294 q 0,-0.904412 0.64706,-1.536764 L 6.17647,7.176471 Q 5.54412,7.82353 4.64706,7.82353 q -0.88235,0 -1.5,-0.617648 L 1.617647,5.676471 Q 1,5.058824 1,4.176471 1,3.294118 1.625,2.683824 L 2.70588,1.610294 Q 3.31618,1 4.19853,1 q 0.88971,0 1.5,0.625 l 1.51471,1.522059 q 0.61029,0.610294 0.61029,1.492647 0,0.904412 -0.64706,1.536764 L 7.82353,6.823529 Q 8.45588,6.17647 9.35294,6.17647 q 0.88235,0 1.5,0.617648 l 1.52941,1.529411 Q 13,8.941176 13,9.823529 z&quot;/&gt;&lt;/svg&gt;
          &lt;/a&gt;&lt;/h2&gt;

&lt;p&gt;Once our new implementation passed all its tests, we turned our attention to performance. We assessed performance at a high level using PDF render time, and then iterated on improvements guided by benchmarks that rendered all of the glyphs from three different fonts. These improvements fell into four main categories.&lt;/p&gt;

&lt;h3 id=&quot;minimizing-runtime-overhead&quot; class=&quot;header-with-anchor&quot;&gt;Minimizing runtime overhead &lt;a title=&quot;Permalink for Minimizing runtime overhead section&quot; href=&quot;#minimizing-runtime-overhead&quot;&gt;
            &lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt; &lt;svg width=&quot;18px&quot; height=&quot;18px&quot; viewBox=&quot;0 0 14 14&quot; role=&quot;img&quot; focusable=&quot;false&quot; aria-hidden=&quot;true&quot; xmlns=&quot;http://www.w3.org/2000/svg&quot;&gt;&lt;path d=&quot;m 11.58824,9.823529 q 0,-0.294117 -0.20589,-0.499999 L 9.85294,7.794118 q -0.20588,-0.205883 -0.5,-0.205883 -0.30882,0 -0.52941,0.235295 0.0221,0.02206 0.13971,0.136029 0.11764,0.113971 0.15808,0.158088 0.0404,0.04412 0.1103,0.139706 0.0698,0.09559 0.0956,0.1875 0.0257,0.09191 0.0257,0.202206 0,0.294117 -0.20588,0.5 -0.20588,0.205882 -0.5,0.205882 -0.1103,0 -0.20221,-0.02573 Q 8.35293,9.301471 8.25733,9.231621 8.16173,9.161771 8.11763,9.121327 8.07353,9.080887 7.95954,8.963238 7.84557,8.845591 7.82351,8.823533 7.58086,9.051474 7.58086,9.360297 q 0,0.294118 0.20588,0.5 l 1.51471,1.522059 q 0.19853,0.19853 0.5,0.19853 0.29412,0 0.5,-0.191177 l 1.08088,-1.073529 q 0.20589,-0.205883 0.20589,-0.492648 z M 6.41912,4.639706 q 0,-0.294118 -0.20588,-0.5 L 4.69853,2.617647 q -0.20588,-0.205882 -0.5,-0.205882 -0.28677,0 -0.5,0.198529 L 2.61765,3.683823 q -0.20589,0.205883 -0.20589,0.492648 0,0.294117 0.20589,0.499999 l 1.52941,1.529412 q 0.19853,0.19853 0.5,0.19853 0.30882,0 0.52941,-0.227942 Q 5.15437,6.15441 5.03676,6.040441 4.91912,5.92647 4.87868,5.882353 4.83828,5.838233 4.76838,5.742647 q -0.0698,-0.09559 -0.0956,-0.1875 -0.0257,-0.09191 -0.0257,-0.202206 0,-0.294117 0.20588,-0.5 0.20588,-0.205882 0.5,-0.205882 0.1103,0 0.20221,0.02573 0.0919,0.02573 0.1875,0.09559 0.0956,0.06985 0.1397,0.110294 0.0441,0.04044 0.15809,0.158089 Q 6.15443,5.154409 6.17649,5.176467 6.41914,4.948526 6.41914,4.639703 z M 13,9.823529 q 0,0.882353 -0.625,1.492647 l -1.08088,1.07353 Q 10.68382,13 9.80147,13 q -0.88971,0 -1.5,-0.625 L 6.78676,10.852941 Q 6.17647,10.242647 6.17647,9.360294 q 0,-0.904412 0.64706,-1.536764 L 6.17647,7.176471 Q 5.54412,7.82353 4.64706,7.82353 q -0.88235,0 -1.5,-0.617648 L 1.617647,5.676471 Q 1,5.058824 1,4.176471 1,3.294118 1.625,2.683824 L 2.70588,1.610294 Q 3.31618,1 4.19853,1 q 0.88971,0 1.5,0.625 l 1.51471,1.522059 q 0.61029,0.610294 0.61029,1.492647 0,0.904412 -0.64706,1.536764 L 7.82353,6.823529 Q 8.45588,6.17647 9.35294,6.17647 q 0.88235,0 1.5,0.617648 l 1.52941,1.529411 Q 13,8.941176 13,9.823529 z&quot;/&gt;&lt;/svg&gt;
          &lt;/a&gt;&lt;/h3&gt;

&lt;p&gt;Swift uses &lt;a href=&quot;https://docs.swift.org/swift-book/documentation/the-swift-programming-language/automaticreferencecounting/&quot;&gt;automatic reference counting&lt;/a&gt; for managing the lifetime of shared reference types, and runtime exclusivity checking for preventing overlapping access to data structures. These sources of overhead are often exacerbated by aliasing, an irreducible amount of which existed in the interpreter’s specification by design.&lt;/p&gt;

&lt;p&gt;These sources of overhead can be eliminated by giving up the convenience of copyability, adopting &lt;a href=&quot;https://developer.apple.com/documentation/Swift/Copyable&quot;&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;~Copyable&lt;/code&gt;&lt;/a&gt; value types (see also: &lt;a href=&quot;https://developer.apple.com/documentation/swift/choosing-between-structures-and-classes&quot;&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;struct&lt;/code&gt; instead of &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;class&lt;/code&gt;&lt;/a&gt;) throughout the architecture, reserving reference types for high-level abstractions. &lt;a href=&quot;https://developer.apple.com/documentation/swift/span&quot;&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Span&lt;/code&gt;&lt;/a&gt;, introduced in Swift 6.2 with back-deployment support all the way back to macOS 10.14.4 and iOS 12.2, allowed us to efficiently operate on sequences of these types.&lt;/p&gt;

&lt;h3 id=&quot;moving-data-around&quot; class=&quot;header-with-anchor&quot;&gt;Moving data around &lt;a title=&quot;Permalink for Moving data around section&quot; href=&quot;#moving-data-around&quot;&gt;
            &lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt; &lt;svg width=&quot;18px&quot; height=&quot;18px&quot; viewBox=&quot;0 0 14 14&quot; role=&quot;img&quot; focusable=&quot;false&quot; aria-hidden=&quot;true&quot; xmlns=&quot;http://www.w3.org/2000/svg&quot;&gt;&lt;path d=&quot;m 11.58824,9.823529 q 0,-0.294117 -0.20589,-0.499999 L 9.85294,7.794118 q -0.20588,-0.205883 -0.5,-0.205883 -0.30882,0 -0.52941,0.235295 0.0221,0.02206 0.13971,0.136029 0.11764,0.113971 0.15808,0.158088 0.0404,0.04412 0.1103,0.139706 0.0698,0.09559 0.0956,0.1875 0.0257,0.09191 0.0257,0.202206 0,0.294117 -0.20588,0.5 -0.20588,0.205882 -0.5,0.205882 -0.1103,0 -0.20221,-0.02573 Q 8.35293,9.301471 8.25733,9.231621 8.16173,9.161771 8.11763,9.121327 8.07353,9.080887 7.95954,8.963238 7.84557,8.845591 7.82351,8.823533 7.58086,9.051474 7.58086,9.360297 q 0,0.294118 0.20588,0.5 l 1.51471,1.522059 q 0.19853,0.19853 0.5,0.19853 0.29412,0 0.5,-0.191177 l 1.08088,-1.073529 q 0.20589,-0.205883 0.20589,-0.492648 z M 6.41912,4.639706 q 0,-0.294118 -0.20588,-0.5 L 4.69853,2.617647 q -0.20588,-0.205882 -0.5,-0.205882 -0.28677,0 -0.5,0.198529 L 2.61765,3.683823 q -0.20589,0.205883 -0.20589,0.492648 0,0.294117 0.20589,0.499999 l 1.52941,1.529412 q 0.19853,0.19853 0.5,0.19853 0.30882,0 0.52941,-0.227942 Q 5.15437,6.15441 5.03676,6.040441 4.91912,5.92647 4.87868,5.882353 4.83828,5.838233 4.76838,5.742647 q -0.0698,-0.09559 -0.0956,-0.1875 -0.0257,-0.09191 -0.0257,-0.202206 0,-0.294117 0.20588,-0.5 0.20588,-0.205882 0.5,-0.205882 0.1103,0 0.20221,0.02573 0.0919,0.02573 0.1875,0.09559 0.0956,0.06985 0.1397,0.110294 0.0441,0.04044 0.15809,0.158089 Q 6.15443,5.154409 6.17649,5.176467 6.41914,4.948526 6.41914,4.639703 z M 13,9.823529 q 0,0.882353 -0.625,1.492647 l -1.08088,1.07353 Q 10.68382,13 9.80147,13 q -0.88971,0 -1.5,-0.625 L 6.78676,10.852941 Q 6.17647,10.242647 6.17647,9.360294 q 0,-0.904412 0.64706,-1.536764 L 6.17647,7.176471 Q 5.54412,7.82353 4.64706,7.82353 q -0.88235,0 -1.5,-0.617648 L 1.617647,5.676471 Q 1,5.058824 1,4.176471 1,3.294118 1.625,2.683824 L 2.70588,1.610294 Q 3.31618,1 4.19853,1 q 0.88971,0 1.5,0.625 l 1.51471,1.522059 q 0.61029,0.610294 0.61029,1.492647 0,0.904412 -0.64706,1.536764 L 7.82353,6.823529 Q 8.45588,6.17647 9.35294,6.17647 q 0.88235,0 1.5,0.617648 l 1.52941,1.529411 Q 13,8.941176 13,9.823529 z&quot;/&gt;&lt;/svg&gt;
          &lt;/a&gt;&lt;/h3&gt;

&lt;p&gt;Sometimes we want to change the “shape” of structured data when crossing language boundaries to better match the idioms on the other side. In Swift, glyph outlines are represented by a sequence of points, each of which carries a flag for whether it’s ‘on a curve’, flags for whether it’s been ‘touched’ on each axis, and three coordinate pairs: original (in the font’s base units), scaled (to the desired point size), and hinted (the interpreter program’s output).&lt;/p&gt;

&lt;p&gt;The original C code stored these points in one struct with eight arrays. This is good from a performance perspective because it’s cache-friendly: you can operate on a dimension of many points in long runs, which is fast. But exposing the data in Swift as a collection of point elements resulted in source code that was easier to follow.&lt;/p&gt;

&lt;p&gt;The initial cross-language bridging code we wrote prioritized expediency, safety, and simplicity by copying the glyph’s data from its C struct into Swift and then back after the program completed. Initially, those copies accounted for around 20% of the new interpreter’s runtime. In the end we wound up using projection types that provide safe access to the underlying C structure. Swift thus gives us readability without copying or otherwise transforming the underlying data structure.&lt;/p&gt;

&lt;p&gt;Following WebKit’s &lt;a href=&quot;https://github.com/WebKit/WebKit/wiki/Safer-Swift-Guidelines&quot;&gt;Safer Swift Guidelines&lt;/a&gt;, the example below demonstrates how to wrap a bridged structure from C in a projection type that uses &lt;a href=&quot;https://github.com/apple/swift-collections/blob/main/Sources/ContainersPreview/Types/Ref.swift&quot;&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Ref&lt;/code&gt;&lt;/a&gt; for lifetime safety, brokers bounds-safe access to the underlying data, and returns idiomatic Swift types to its callers. All &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;unsafe&lt;/code&gt; expressions bear &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;// SAFETY:&lt;/code&gt; comments that document the safety invariants and the reasoning which guarantees that they are true.&lt;/p&gt;

&lt;div class=&quot;language-swift highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;kd&quot;&gt;@safe&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;struct&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;Zone&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;~Copyable&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;~&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;Escapable&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
  &lt;span class=&quot;k&quot;&gt;let&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;_element&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;Ref&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;fnt_ElementType&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt;

  &lt;span class=&quot;kd&quot;&gt;@_lifetime&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;copy&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;element&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;nf&quot;&gt;init&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;wrapping&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;element&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;Ref&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;fnt_ElementType&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;c1&quot;&gt;// SAFETY: the `fnt_ElementType` passed by the caller must satisfy:&lt;/span&gt;
    &lt;span class=&quot;c1&quot;&gt;// * `sp`, `ep` point at arrays of length ≥ `maxContourCount`.&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;unsafe&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;_element&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;element&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;

  &lt;span class=&quot;kd&quot;&gt;func&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;readContour&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;index&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;Int&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;ClosedRange&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;Int&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;nf&quot;&gt;precondition&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;..&amp;lt;&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;contourCount&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;~=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;index&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;c1&quot;&gt;// SAFETY: `index` is bounds checked above; `_element.pointee.sp` and `_element.pointee.ep`&lt;/span&gt;
    &lt;span class=&quot;c1&quot;&gt;// are live arrays of length `maxContourCount` per `init(wrapping:)` premises.&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;unsafe&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;Int&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;_element&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;value&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;sp&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;index&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;])&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;...&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;Int&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;_element&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;value&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;ep&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;index&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;])&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h3 id=&quot;short-lived-allocations&quot; class=&quot;header-with-anchor&quot;&gt;Short-lived allocations &lt;a title=&quot;Permalink for Short-lived allocations section&quot; href=&quot;#short-lived-allocations&quot;&gt;
            &lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt; &lt;svg width=&quot;18px&quot; height=&quot;18px&quot; viewBox=&quot;0 0 14 14&quot; role=&quot;img&quot; focusable=&quot;false&quot; aria-hidden=&quot;true&quot; xmlns=&quot;http://www.w3.org/2000/svg&quot;&gt;&lt;path d=&quot;m 11.58824,9.823529 q 0,-0.294117 -0.20589,-0.499999 L 9.85294,7.794118 q -0.20588,-0.205883 -0.5,-0.205883 -0.30882,0 -0.52941,0.235295 0.0221,0.02206 0.13971,0.136029 0.11764,0.113971 0.15808,0.158088 0.0404,0.04412 0.1103,0.139706 0.0698,0.09559 0.0956,0.1875 0.0257,0.09191 0.0257,0.202206 0,0.294117 -0.20588,0.5 -0.20588,0.205882 -0.5,0.205882 -0.1103,0 -0.20221,-0.02573 Q 8.35293,9.301471 8.25733,9.231621 8.16173,9.161771 8.11763,9.121327 8.07353,9.080887 7.95954,8.963238 7.84557,8.845591 7.82351,8.823533 7.58086,9.051474 7.58086,9.360297 q 0,0.294118 0.20588,0.5 l 1.51471,1.522059 q 0.19853,0.19853 0.5,0.19853 0.29412,0 0.5,-0.191177 l 1.08088,-1.073529 q 0.20589,-0.205883 0.20589,-0.492648 z M 6.41912,4.639706 q 0,-0.294118 -0.20588,-0.5 L 4.69853,2.617647 q -0.20588,-0.205882 -0.5,-0.205882 -0.28677,0 -0.5,0.198529 L 2.61765,3.683823 q -0.20589,0.205883 -0.20589,0.492648 0,0.294117 0.20589,0.499999 l 1.52941,1.529412 q 0.19853,0.19853 0.5,0.19853 0.30882,0 0.52941,-0.227942 Q 5.15437,6.15441 5.03676,6.040441 4.91912,5.92647 4.87868,5.882353 4.83828,5.838233 4.76838,5.742647 q -0.0698,-0.09559 -0.0956,-0.1875 -0.0257,-0.09191 -0.0257,-0.202206 0,-0.294117 0.20588,-0.5 0.20588,-0.205882 0.5,-0.205882 0.1103,0 0.20221,0.02573 0.0919,0.02573 0.1875,0.09559 0.0956,0.06985 0.1397,0.110294 0.0441,0.04044 0.15809,0.158089 Q 6.15443,5.154409 6.17649,5.176467 6.41914,4.948526 6.41914,4.639703 z M 13,9.823529 q 0,0.882353 -0.625,1.492647 l -1.08088,1.07353 Q 10.68382,13 9.80147,13 q -0.88971,0 -1.5,-0.625 L 6.78676,10.852941 Q 6.17647,10.242647 6.17647,9.360294 q 0,-0.904412 0.64706,-1.536764 L 6.17647,7.176471 Q 5.54412,7.82353 4.64706,7.82353 q -0.88235,0 -1.5,-0.617648 L 1.617647,5.676471 Q 1,5.058824 1,4.176471 1,3.294118 1.625,2.683824 L 2.70588,1.610294 Q 3.31618,1 4.19853,1 q 0.88971,0 1.5,0.625 l 1.51471,1.522059 q 0.61029,0.610294 0.61029,1.492647 0,0.904412 -0.64706,1.536764 L 7.82353,6.823529 Q 8.45588,6.17647 9.35294,6.17647 q 0.88235,0 1.5,0.617648 l 1.52941,1.529411 Q 13,8.941176 13,9.823529 z&quot;/&gt;&lt;/svg&gt;
          &lt;/a&gt;&lt;/h3&gt;

&lt;p&gt;While runtime overhead imposes its costs in aggregate, and copying data across the language border showed up as a specific hot spot, the costs of short-lived memory allocations can show up in both ways.&lt;/p&gt;

&lt;p&gt;Operations like &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;filter&lt;/code&gt; and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;map&lt;/code&gt; allocate memory, but that allocation is only necessary if the value escapes. The Swift standard library provides &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;.lazy.map&lt;/code&gt; and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;.lazy.filter&lt;/code&gt;, but they don’t work in every case. For logic that only &lt;em&gt;iterates&lt;/em&gt; over the filter or map, it’s much more efficient to loop with &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;continue&lt;/code&gt; (or use &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;for … in … where&lt;/code&gt;) and transform elements into local variables as necessary.&lt;/p&gt;

&lt;p&gt;Allocations that exist exclusively to pass results to a function’s caller can be elided too. For example, we often needed to &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;pop&lt;/code&gt; the last &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;n&lt;/code&gt; elements from the interpreter’s stack. The obvious implementation of this operation has to allocate space for the elements it returns (because the function simultaneously removes them) and looks something like:&lt;/p&gt;

&lt;div class=&quot;language-swift highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;k&quot;&gt;mutating&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;func&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;pop&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;count&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;n&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;Int&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;Element&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
  &lt;span class=&quot;k&quot;&gt;defer&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;items&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;removeLast&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;n&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
  &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;Array&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;items&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;suffix&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;n&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Optimizing this operation without compromising safety eventually led us to a continuation-passing approach where the caller passes a block that can operate on a slice of stack elements before they are removed. Swift’s compile-time exclusivity checking ensured that the stack could not be modified from inside the block, and the interface structurally eliminated any need for heap allocations or element copying.&lt;/p&gt;

&lt;div class=&quot;language-swift highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;k&quot;&gt;mutating&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;func&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;pop&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;R&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;E&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;Error&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;count&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;n&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;Int&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;_&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;op&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kd&quot;&gt;borrowing&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;Span&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;Element&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;throws&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;E&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;R&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;throws&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;E&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;R&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
  &lt;span class=&quot;k&quot;&gt;defer&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;items&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;removeLast&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;n&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
  &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;try&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;op&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;items&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;span&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;extracting&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;last&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;n&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h3 id=&quot;dynamic-dispatch&quot; class=&quot;header-with-anchor&quot;&gt;Dynamic dispatch &lt;a title=&quot;Permalink for Dynamic dispatch section&quot; href=&quot;#dynamic-dispatch&quot;&gt;
            &lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt; &lt;svg width=&quot;18px&quot; height=&quot;18px&quot; viewBox=&quot;0 0 14 14&quot; role=&quot;img&quot; focusable=&quot;false&quot; aria-hidden=&quot;true&quot; xmlns=&quot;http://www.w3.org/2000/svg&quot;&gt;&lt;path d=&quot;m 11.58824,9.823529 q 0,-0.294117 -0.20589,-0.499999 L 9.85294,7.794118 q -0.20588,-0.205883 -0.5,-0.205883 -0.30882,0 -0.52941,0.235295 0.0221,0.02206 0.13971,0.136029 0.11764,0.113971 0.15808,0.158088 0.0404,0.04412 0.1103,0.139706 0.0698,0.09559 0.0956,0.1875 0.0257,0.09191 0.0257,0.202206 0,0.294117 -0.20588,0.5 -0.20588,0.205882 -0.5,0.205882 -0.1103,0 -0.20221,-0.02573 Q 8.35293,9.301471 8.25733,9.231621 8.16173,9.161771 8.11763,9.121327 8.07353,9.080887 7.95954,8.963238 7.84557,8.845591 7.82351,8.823533 7.58086,9.051474 7.58086,9.360297 q 0,0.294118 0.20588,0.5 l 1.51471,1.522059 q 0.19853,0.19853 0.5,0.19853 0.29412,0 0.5,-0.191177 l 1.08088,-1.073529 q 0.20589,-0.205883 0.20589,-0.492648 z M 6.41912,4.639706 q 0,-0.294118 -0.20588,-0.5 L 4.69853,2.617647 q -0.20588,-0.205882 -0.5,-0.205882 -0.28677,0 -0.5,0.198529 L 2.61765,3.683823 q -0.20589,0.205883 -0.20589,0.492648 0,0.294117 0.20589,0.499999 l 1.52941,1.529412 q 0.19853,0.19853 0.5,0.19853 0.30882,0 0.52941,-0.227942 Q 5.15437,6.15441 5.03676,6.040441 4.91912,5.92647 4.87868,5.882353 4.83828,5.838233 4.76838,5.742647 q -0.0698,-0.09559 -0.0956,-0.1875 -0.0257,-0.09191 -0.0257,-0.202206 0,-0.294117 0.20588,-0.5 0.20588,-0.205882 0.5,-0.205882 0.1103,0 0.20221,0.02573 0.0919,0.02573 0.1875,0.09559 0.0956,0.06985 0.1397,0.110294 0.0441,0.04044 0.15809,0.158089 Q 6.15443,5.154409 6.17649,5.176467 6.41914,4.948526 6.41914,4.639703 z M 13,9.823529 q 0,0.882353 -0.625,1.492647 l -1.08088,1.07353 Q 10.68382,13 9.80147,13 q -0.88971,0 -1.5,-0.625 L 6.78676,10.852941 Q 6.17647,10.242647 6.17647,9.360294 q 0,-0.904412 0.64706,-1.536764 L 6.17647,7.176471 Q 5.54412,7.82353 4.64706,7.82353 q -0.88235,0 -1.5,-0.617648 L 1.617647,5.676471 Q 1,5.058824 1,4.176471 1,3.294118 1.625,2.683824 L 2.70588,1.610294 Q 3.31618,1 4.19853,1 q 0.88971,0 1.5,0.625 l 1.51471,1.522059 q 0.61029,0.610294 0.61029,1.492647 0,0.904412 -0.64706,1.536764 L 7.82353,6.823529 Q 8.45588,6.17647 9.35294,6.17647 q 0.88235,0 1.5,0.617648 l 1.52941,1.529411 Q 13,8.941176 13,9.823529 z&quot;/&gt;&lt;/svg&gt;
          &lt;/a&gt;&lt;/h3&gt;

&lt;p&gt;Abstraction mechanisms like protocols, generics, and inheritance are very powerful, but they introduce method-call indirection that may manifest at runtime as dynamic dispatch. This overhead can often be eliminated by the optimizer, but that is not possible in all conditions. In our case, not making abstractions more generic than necessary and encouraging the toolchain to inline were sufficient for the optimizer to hoist bounds checks and specialize all of our generic contexts. When you’re profiling your code, if you see unspecialized generics or protocol witness tables in hot paths, that’s a sign that the optimizer does not have sufficient visibility to optimize the call sites and that your implementation may benefit from inlining.&lt;/p&gt;

&lt;h2 id=&quot;zero-cost-abstractions&quot; class=&quot;header-with-anchor&quot;&gt;Zero-cost abstractions &lt;a title=&quot;Permalink for Zero-cost abstractions section&quot; href=&quot;#zero-cost-abstractions&quot;&gt;
            &lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt; &lt;svg width=&quot;18px&quot; height=&quot;18px&quot; viewBox=&quot;0 0 14 14&quot; role=&quot;img&quot; focusable=&quot;false&quot; aria-hidden=&quot;true&quot; xmlns=&quot;http://www.w3.org/2000/svg&quot;&gt;&lt;path d=&quot;m 11.58824,9.823529 q 0,-0.294117 -0.20589,-0.499999 L 9.85294,7.794118 q -0.20588,-0.205883 -0.5,-0.205883 -0.30882,0 -0.52941,0.235295 0.0221,0.02206 0.13971,0.136029 0.11764,0.113971 0.15808,0.158088 0.0404,0.04412 0.1103,0.139706 0.0698,0.09559 0.0956,0.1875 0.0257,0.09191 0.0257,0.202206 0,0.294117 -0.20588,0.5 -0.20588,0.205882 -0.5,0.205882 -0.1103,0 -0.20221,-0.02573 Q 8.35293,9.301471 8.25733,9.231621 8.16173,9.161771 8.11763,9.121327 8.07353,9.080887 7.95954,8.963238 7.84557,8.845591 7.82351,8.823533 7.58086,9.051474 7.58086,9.360297 q 0,0.294118 0.20588,0.5 l 1.51471,1.522059 q 0.19853,0.19853 0.5,0.19853 0.29412,0 0.5,-0.191177 l 1.08088,-1.073529 q 0.20589,-0.205883 0.20589,-0.492648 z M 6.41912,4.639706 q 0,-0.294118 -0.20588,-0.5 L 4.69853,2.617647 q -0.20588,-0.205882 -0.5,-0.205882 -0.28677,0 -0.5,0.198529 L 2.61765,3.683823 q -0.20589,0.205883 -0.20589,0.492648 0,0.294117 0.20589,0.499999 l 1.52941,1.529412 q 0.19853,0.19853 0.5,0.19853 0.30882,0 0.52941,-0.227942 Q 5.15437,6.15441 5.03676,6.040441 4.91912,5.92647 4.87868,5.882353 4.83828,5.838233 4.76838,5.742647 q -0.0698,-0.09559 -0.0956,-0.1875 -0.0257,-0.09191 -0.0257,-0.202206 0,-0.294117 0.20588,-0.5 0.20588,-0.205882 0.5,-0.205882 0.1103,0 0.20221,0.02573 0.0919,0.02573 0.1875,0.09559 0.0956,0.06985 0.1397,0.110294 0.0441,0.04044 0.15809,0.158089 Q 6.15443,5.154409 6.17649,5.176467 6.41914,4.948526 6.41914,4.639703 z M 13,9.823529 q 0,0.882353 -0.625,1.492647 l -1.08088,1.07353 Q 10.68382,13 9.80147,13 q -0.88971,0 -1.5,-0.625 L 6.78676,10.852941 Q 6.17647,10.242647 6.17647,9.360294 q 0,-0.904412 0.64706,-1.536764 L 6.17647,7.176471 Q 5.54412,7.82353 4.64706,7.82353 q -0.88235,0 -1.5,-0.617648 L 1.617647,5.676471 Q 1,5.058824 1,4.176471 1,3.294118 1.625,2.683824 L 2.70588,1.610294 Q 3.31618,1 4.19853,1 q 0.88971,0 1.5,0.625 l 1.51471,1.522059 q 0.61029,0.610294 0.61029,1.492647 0,0.904412 -0.64706,1.536764 L 7.82353,6.823529 Q 8.45588,6.17647 9.35294,6.17647 q 0.88235,0 1.5,0.617648 l 1.52941,1.529411 Q 13,8.941176 13,9.823529 z&quot;/&gt;&lt;/svg&gt;
          &lt;/a&gt;&lt;/h2&gt;

&lt;p&gt;At this point, anyone accustomed to grinding out performance improvements in a project might reasonably expect that our optimizations could come at the cost of readability, but in reality Swift’s type system and optimizer enabled us to employ abstractions that resulted in highly legible code. For example:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;FixedPoint&lt;/code&gt; types provided the same ergonomics as integral types, encapsulating complex rounding and shifting arithmetic.&lt;/li&gt;
  &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;StackElement&lt;/code&gt; provided access to 32-bit values with built-in conversions for all eight of its supported numeric types.&lt;/li&gt;
  &lt;li&gt;Our projection types provided safe and natural access to data that was not structured with those considerations in mind.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Swift’s type system makes it possible to define powerful and expressive abstractions. When built with optimizations, all of our abstractions added zero cost while substantially improving readability.&lt;/p&gt;

&lt;h2 id=&quot;memory-safe-and-faster-than-c&quot; class=&quot;header-with-anchor&quot;&gt;Memory-safe and faster than C &lt;a title=&quot;Permalink for Memory-safe and faster than C section&quot; href=&quot;#memory-safe-and-faster-than-c&quot;&gt;
            &lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt; &lt;svg width=&quot;18px&quot; height=&quot;18px&quot; viewBox=&quot;0 0 14 14&quot; role=&quot;img&quot; focusable=&quot;false&quot; aria-hidden=&quot;true&quot; xmlns=&quot;http://www.w3.org/2000/svg&quot;&gt;&lt;path d=&quot;m 11.58824,9.823529 q 0,-0.294117 -0.20589,-0.499999 L 9.85294,7.794118 q -0.20588,-0.205883 -0.5,-0.205883 -0.30882,0 -0.52941,0.235295 0.0221,0.02206 0.13971,0.136029 0.11764,0.113971 0.15808,0.158088 0.0404,0.04412 0.1103,0.139706 0.0698,0.09559 0.0956,0.1875 0.0257,0.09191 0.0257,0.202206 0,0.294117 -0.20588,0.5 -0.20588,0.205882 -0.5,0.205882 -0.1103,0 -0.20221,-0.02573 Q 8.35293,9.301471 8.25733,9.231621 8.16173,9.161771 8.11763,9.121327 8.07353,9.080887 7.95954,8.963238 7.84557,8.845591 7.82351,8.823533 7.58086,9.051474 7.58086,9.360297 q 0,0.294118 0.20588,0.5 l 1.51471,1.522059 q 0.19853,0.19853 0.5,0.19853 0.29412,0 0.5,-0.191177 l 1.08088,-1.073529 q 0.20589,-0.205883 0.20589,-0.492648 z M 6.41912,4.639706 q 0,-0.294118 -0.20588,-0.5 L 4.69853,2.617647 q -0.20588,-0.205882 -0.5,-0.205882 -0.28677,0 -0.5,0.198529 L 2.61765,3.683823 q -0.20589,0.205883 -0.20589,0.492648 0,0.294117 0.20589,0.499999 l 1.52941,1.529412 q 0.19853,0.19853 0.5,0.19853 0.30882,0 0.52941,-0.227942 Q 5.15437,6.15441 5.03676,6.040441 4.91912,5.92647 4.87868,5.882353 4.83828,5.838233 4.76838,5.742647 q -0.0698,-0.09559 -0.0956,-0.1875 -0.0257,-0.09191 -0.0257,-0.202206 0,-0.294117 0.20588,-0.5 0.20588,-0.205882 0.5,-0.205882 0.1103,0 0.20221,0.02573 0.0919,0.02573 0.1875,0.09559 0.0956,0.06985 0.1397,0.110294 0.0441,0.04044 0.15809,0.158089 Q 6.15443,5.154409 6.17649,5.176467 6.41914,4.948526 6.41914,4.639703 z M 13,9.823529 q 0,0.882353 -0.625,1.492647 l -1.08088,1.07353 Q 10.68382,13 9.80147,13 q -0.88971,0 -1.5,-0.625 L 6.78676,10.852941 Q 6.17647,10.242647 6.17647,9.360294 q 0,-0.904412 0.64706,-1.536764 L 6.17647,7.176471 Q 5.54412,7.82353 4.64706,7.82353 q -0.88235,0 -1.5,-0.617648 L 1.617647,5.676471 Q 1,5.058824 1,4.176471 1,3.294118 1.625,2.683824 L 2.70588,1.610294 Q 3.31618,1 4.19853,1 q 0.88971,0 1.5,0.625 l 1.51471,1.522059 q 0.61029,0.610294 0.61029,1.492647 0,0.904412 -0.64706,1.536764 L 7.82353,6.823529 Q 8.45588,6.17647 9.35294,6.17647 q 0.88235,0 1.5,0.617648 l 1.52941,1.529411 Q 13,8.941176 13,9.823529 z&quot;/&gt;&lt;/svg&gt;
          &lt;/a&gt;&lt;/h2&gt;

&lt;p&gt;Our goal for this project was to make the TrueType hinting interpreter fully memory-safe, to have the same observable rendering behavior as the C implementation, and to achieve a level of performance that did not regress any user-visible benchmarks.&lt;/p&gt;

&lt;p&gt;We met these goals. The Swift interpreter includes a small number of thoroughly verified &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;unsafe&lt;/code&gt; statements at the language interop boundary; there have been no bugs reported against it since it was enabled; and it’s &lt;em&gt;faster&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;On average, the Swift interpreter runs 13% faster than the C interpreter it replaced. Here is a chart showing the average CPU megacycles spent per glyph in the Swift implementation versus the C implementation for all of the hinted fonts that ship on macOS, plus a sampling of non-system fonts:&lt;/p&gt;

&lt;div id=&quot;hinting-chart-wrap&quot; style=&quot;margin: 1.2em 0;&quot;&gt;
&lt;style&gt;
#hinting-chart-wrap .card { background:var(--blog-card-bg); border:1px solid var(--blog-dropdown-toggle-outline-color); border-radius:16px; padding:14px 14px 8px; }
#hinting-chart-wrap #hinting-chart-svg { width:100%; height:auto; display:block; }
#hinting-chart-wrap .axislabel { font-size:13px; fill:var(--site-text-color); opacity:.78; }
#hinting-chart-wrap .ticklabel { font-size:11px; fill:var(--blog-muted-color); }
#hinting-chart-wrap .grid { stroke:color-mix(in srgb, var(--blog-dropdown-toggle-outline-color) 70%, transparent); stroke-width:1; }
#hinting-chart-wrap .parity { stroke:var(--blog-muted-color); stroke-width:1.3; stroke-dasharray:6 4; opacity:.7; }
#hinting-chart-wrap .frame { stroke:var(--blog-dropdown-toggle-outline-color); stroke-width:1; fill:none; }
#hinting-chart-wrap .pt { stroke:var(--blog-page-code-bg); stroke-width:.6; cursor:pointer; transition:r .08s, fill-opacity .08s; }
#hinting-chart-wrap .pt.sys { fill:var(--site-link-with-right-arrow-color); fill-opacity:.85; }
#hinting-chart-wrap .pt.tp  { fill:var(--color-syntax-other-preprocessor-macros); fill-opacity:.85; }
#hinting-chart-wrap .pt:hover { r:7; fill-opacity:1; stroke:var(--site-text-color); stroke-width:1.3; }
#hinting-chart-wrap .legend { text-align:center; color:var(--blog-muted-color); font-size:12px; margin-top:12px; }
#hinting-chart-wrap .legend b.sys { color:var(--site-link-with-right-arrow-color); }
#hinting-chart-wrap .legend b.tp { color:var(--color-syntax-other-preprocessor-macros); }
#hinting-chart-tip { position:fixed; pointer-events:none; opacity:0; z-index:10; background:var(--blog-card-bg); color:var(--site-text-color); padding:9px 12px; border-radius:10px; border:1px solid var(--blog-dropdown-toggle-outline-color); font-size:12px; line-height:1.55; box-shadow:0 8px 28px rgba(0,0,0,.4); transform:translate(-50%,-118%); white-space:nowrap; transition:opacity .08s; }
#hinting-chart-tip b { font-size:12.5px; }
#hinting-chart-tip .dim { color:var(--blog-muted-color); }
#hinting-chart-tip .sp { font-weight:700; }
&lt;/style&gt;
&lt;div class=&quot;card&quot;&gt;&lt;svg id=&quot;hinting-chart-svg&quot; viewBox=&quot;0 0 640 660&quot; xmlns=&quot;http://www.w3.org/2000/svg&quot;&gt;&lt;/svg&gt;&lt;/div&gt;
&lt;div class=&quot;legend&quot;&gt;&lt;b class=&quot;sys&quot;&gt;&amp;#9679; System font&lt;/b&gt; &amp;middot; &lt;b class=&quot;tp&quot;&gt;&amp;#9679; Non-system font&lt;/b&gt; &amp;middot; below the line: Swift faster &amp;middot; above: C faster&lt;/div&gt;
&lt;/div&gt;
&lt;div id=&quot;hinting-chart-tip&quot;&gt;&lt;/div&gt;
&lt;script&gt;
(function(){
const SYS=[{&quot;n&quot;:&quot;ArialUnicodeMS&quot;,&quot;x&quot;:0.301241,&quot;y&quot;:0.260143,&quot;g&quot;:50377,&quot;sp&quot;:13.6},{&quot;n&quot;:&quot;LucidaGrande&quot;,&quot;x&quot;:0.187721,&quot;y&quot;:0.160143,&quot;g&quot;:2826,&quot;sp&quot;:14.7},{&quot;n&quot;:&quot;LucidaGrande-Bold&quot;,&quot;x&quot;:0.141057,&quot;y&quot;:0.118885,&quot;g&quot;:2826,&quot;sp&quot;:15.7},{&quot;n&quot;:&quot;BrushScriptMT&quot;,&quot;x&quot;:0.113422,&quot;y&quot;:0.009014,&quot;g&quot;:1104,&quot;sp&quot;:92.1},{&quot;n&quot;:&quot;Noteworthy-Light&quot;,&quot;x&quot;:0.111505,&quot;y&quot;:0.089115,&quot;g&quot;:1201,&quot;sp&quot;:20.1},{&quot;n&quot;:&quot;Mshtakan&quot;,&quot;x&quot;:0.110958,&quot;y&quot;:0.089881,&quot;g&quot;:178,&quot;sp&quot;:19.0},{&quot;n&quot;:&quot;DevanagariMT&quot;,&quot;x&quot;:0.10996,&quot;y&quot;:0.08938,&quot;g&quot;:549,&quot;sp&quot;:18.7},{&quot;n&quot;:&quot;Noteworthy-Bold&quot;,&quot;x&quot;:0.107226,&quot;y&quot;:0.085577,&quot;g&quot;:1201,&quot;sp&quot;:20.2},{&quot;n&quot;:&quot;GillSans-Bold&quot;,&quot;x&quot;:0.100517,&quot;y&quot;:0.08892,&quot;g&quot;:969,&quot;sp&quot;:11.5},{&quot;n&quot;:&quot;GillSans-BoldItalic&quot;,&quot;x&quot;:0.100018,&quot;y&quot;:0.087829,&quot;g&quot;:423,&quot;sp&quot;:12.2},{&quot;n&quot;:&quot;Helvetica&quot;,&quot;x&quot;:0.094664,&quot;y&quot;:0.075082,&quot;g&quot;:2252,&quot;sp&quot;:20.7},{&quot;n&quot;:&quot;TimesNewRomanPS-BoldMT&quot;,&quot;x&quot;:0.092942,&quot;y&quot;:0.080878,&quot;g&quot;:3380,&quot;sp&quot;:13.0},{&quot;n&quot;:&quot;Helvetica-Oblique&quot;,&quot;x&quot;:0.091149,&quot;y&quot;:0.073822,&quot;g&quot;:2196,&quot;sp&quot;:19.0},{&quot;n&quot;:&quot;NotoSansKannada-ExtraBold&quot;,&quot;x&quot;:0.090478,&quot;y&quot;:0.070627,&quot;g&quot;:476,&quot;sp&quot;:21.9},{&quot;n&quot;:&quot;NotoSansKannada-Black&quot;,&quot;x&quot;:0.090415,&quot;y&quot;:0.070604,&quot;g&quot;:476,&quot;sp&quot;:21.9},{&quot;n&quot;:&quot;NotoSansKannada-Medium&quot;,&quot;x&quot;:0.0903,&quot;y&quot;:0.07016,&quot;g&quot;:476,&quot;sp&quot;:22.3},{&quot;n&quot;:&quot;NotoSansKannada-Regular&quot;,&quot;x&quot;:0.090101,&quot;y&quot;:0.070025,&quot;g&quot;:476,&quot;sp&quot;:22.3},{&quot;n&quot;:&quot;NotoSansKannada-Bold&quot;,&quot;x&quot;:0.089892,&quot;y&quot;:0.069515,&quot;g&quot;:476,&quot;sp&quot;:22.7},{&quot;n&quot;:&quot;NotoSansKannada-SemiBold&quot;,&quot;x&quot;:0.089653,&quot;y&quot;:0.069413,&quot;g&quot;:476,&quot;sp&quot;:22.6},{&quot;n&quot;:&quot;NotoSansKannada-Light&quot;,&quot;x&quot;:0.089196,&quot;y&quot;:0.070176,&quot;g&quot;:476,&quot;sp&quot;:21.3},{&quot;n&quot;:&quot;NotoSansKannada-ExtraLight&quot;,&quot;x&quot;:0.089046,&quot;y&quot;:0.070066,&quot;g&quot;:476,&quot;sp&quot;:21.3},{&quot;n&quot;:&quot;NotoSansKannada-Thin&quot;,&quot;x&quot;:0.089007,&quot;y&quot;:0.069255,&quot;g&quot;:476,&quot;sp&quot;:22.2},{&quot;n&quot;:&quot;DevanagariMT-Bold&quot;,&quot;x&quot;:0.085848,&quot;y&quot;:0.070331,&quot;g&quot;:549,&quot;sp&quot;:18.1},{&quot;n&quot;:&quot;Charter-BoldItalic&quot;,&quot;x&quot;:0.085824,&quot;y&quot;:0.070743,&quot;g&quot;:2088,&quot;sp&quot;:17.6},{&quot;n&quot;:&quot;BradleyHandITCTT-Bold&quot;,&quot;x&quot;:0.081771,&quot;y&quot;:0.066137,&quot;g&quot;:1534,&quot;sp&quot;:19.1},{&quot;n&quot;:&quot;GujaratiMT&quot;,&quot;x&quot;:0.08153,&quot;y&quot;:0.070298,&quot;g&quot;:465,&quot;sp&quot;:13.8},{&quot;n&quot;:&quot;AcademyEngravedLetPlain&quot;,&quot;x&quot;:0.080137,&quot;y&quot;:0.071497,&quot;g&quot;:625,&quot;sp&quot;:10.8},{&quot;n&quot;:&quot;IowanOldStyle-Black&quot;,&quot;x&quot;:0.079896,&quot;y&quot;:0.070624,&quot;g&quot;:611,&quot;sp&quot;:11.6},{&quot;n&quot;:&quot;CourierNewPS-BoldMT&quot;,&quot;x&quot;:0.079799,&quot;y&quot;:0.072272,&quot;g&quot;:3151,&quot;sp&quot;:9.4},{&quot;n&quot;:&quot;GillSans-Light&quot;,&quot;x&quot;:0.076276,&quot;y&quot;:0.05842,&quot;g&quot;:969,&quot;sp&quot;:23.4},{&quot;n&quot;:&quot;Symbol&quot;,&quot;x&quot;:0.076139,&quot;y&quot;:0.068862,&quot;g&quot;:200,&quot;sp&quot;:9.6},{&quot;n&quot;:&quot;Charter-Italic&quot;,&quot;x&quot;:0.075712,&quot;y&quot;:0.061945,&quot;g&quot;:2088,&quot;sp&quot;:18.2},{&quot;n&quot;:&quot;ArialRoundedMTBold&quot;,&quot;x&quot;:0.075145,&quot;y&quot;:0.073067,&quot;g&quot;:243,&quot;sp&quot;:2.8},{&quot;n&quot;:&quot;TimesNewRomanPSMT&quot;,&quot;x&quot;:0.07465,&quot;y&quot;:0.065183,&quot;g&quot;:3380,&quot;sp&quot;:12.7},{&quot;n&quot;:&quot;CorsivaHebrew-Bold&quot;,&quot;x&quot;:0.073668,&quot;y&quot;:0.058558,&quot;g&quot;:189,&quot;sp&quot;:20.5},{&quot;n&quot;:&quot;GujaratiMT-Bold&quot;,&quot;x&quot;:0.073129,&quot;y&quot;:0.06449,&quot;g&quot;:465,&quot;sp&quot;:11.8},{&quot;n&quot;:&quot;NewPeninimMT-Bold&quot;,&quot;x&quot;:0.073015,&quot;y&quot;:0.059661,&quot;g&quot;:189,&quot;sp&quot;:18.3},{&quot;n&quot;:&quot;MicrosoftSansSerif&quot;,&quot;x&quot;:0.072108,&quot;y&quot;:0.061096,&quot;g&quot;:3053,&quot;sp&quot;:15.3},{&quot;n&quot;:&quot;CorsivaHebrew&quot;,&quot;x&quot;:0.071925,&quot;y&quot;:0.057496,&quot;g&quot;:189,&quot;sp&quot;:20.1},{&quot;n&quot;:&quot;Arial-BoldMT&quot;,&quot;x&quot;:0.071303,&quot;y&quot;:0.065089,&quot;g&quot;:3381,&quot;sp&quot;:8.7},{&quot;n&quot;:&quot;Times-BoldItalic&quot;,&quot;x&quot;:0.070715,&quot;y&quot;:0.055442,&quot;g&quot;:1443,&quot;sp&quot;:21.6},{&quot;n&quot;:&quot;NewPeninimMT-Inclined&quot;,&quot;x&quot;:0.069247,&quot;y&quot;:0.056539,&quot;g&quot;:189,&quot;sp&quot;:18.4},{&quot;n&quot;:&quot;CourierNewPS-BoldItalicMT&quot;,&quot;x&quot;:0.068674,&quot;y&quot;:0.062722,&quot;g&quot;:2277,&quot;sp&quot;:8.7},{&quot;n&quot;:&quot;GillSans-Italic&quot;,&quot;x&quot;:0.068668,&quot;y&quot;:0.055164,&quot;g&quot;:423,&quot;sp&quot;:19.7},{&quot;n&quot;:&quot;TimesNewRomanPS-ItalicMT&quot;,&quot;x&quot;:0.067404,&quot;y&quot;:0.062916,&quot;g&quot;:2499,&quot;sp&quot;:6.7},{&quot;n&quot;:&quot;NewPeninimMT&quot;,&quot;x&quot;:0.067259,&quot;y&quot;:0.055492,&quot;g&quot;:189,&quot;sp&quot;:17.5},{&quot;n&quot;:&quot;NewPeninimMT-BoldInclined&quot;,&quot;x&quot;:0.067133,&quot;y&quot;:0.056081,&quot;g&quot;:189,&quot;sp&quot;:16.5},{&quot;n&quot;:&quot;GillSans-LightItalic&quot;,&quot;x&quot;:0.065042,&quot;y&quot;:0.052193,&quot;g&quot;:423,&quot;sp&quot;:19.8},{&quot;n&quot;:&quot;DINAlternate-Bold&quot;,&quot;x&quot;:0.064795,&quot;y&quot;:0.053058,&quot;g&quot;:965,&quot;sp&quot;:18.1},{&quot;n&quot;:&quot;AndaleMono&quot;,&quot;x&quot;:0.064759,&quot;y&quot;:0.055283,&quot;g&quot;:659,&quot;sp&quot;:14.6},{&quot;n&quot;:&quot;Times-Bold&quot;,&quot;x&quot;:0.064709,&quot;y&quot;:0.056411,&quot;g&quot;:1443,&quot;sp&quot;:12.8},{&quot;n&quot;:&quot;Arial-BoldItalicMT&quot;,&quot;x&quot;:0.064427,&quot;y&quot;:0.055929,&quot;g&quot;:2516,&quot;sp&quot;:13.2},{&quot;n&quot;:&quot;Times-Italic&quot;,&quot;x&quot;:0.062189,&quot;y&quot;:0.051438,&quot;g&quot;:1443,&quot;sp&quot;:17.3},{&quot;n&quot;:&quot;TimesNewRomanPS-BoldItalicMT&quot;,&quot;x&quot;:0.061618,&quot;y&quot;:0.054722,&quot;g&quot;:2499,&quot;sp&quot;:11.2},{&quot;n&quot;:&quot;ComicSansMS&quot;,&quot;x&quot;:0.058601,&quot;y&quot;:0.049022,&quot;g&quot;:587,&quot;sp&quot;:16.3},{&quot;n&quot;:&quot;ArialMT&quot;,&quot;x&quot;:0.058258,&quot;y&quot;:0.051938,&quot;g&quot;:3381,&quot;sp&quot;:10.8},{&quot;n&quot;:&quot;Menlo-Regular&quot;,&quot;x&quot;:0.05756,&quot;y&quot;:0.047552,&quot;g&quot;:3157,&quot;sp&quot;:17.4},{&quot;n&quot;:&quot;IowanOldStyle-BlackItalic&quot;,&quot;x&quot;:0.056393,&quot;y&quot;:0.048634,&quot;g&quot;:484,&quot;sp&quot;:13.8},{&quot;n&quot;:&quot;CourierNewPSMT&quot;,&quot;x&quot;:0.055828,&quot;y&quot;:0.049703,&quot;g&quot;:3151,&quot;sp&quot;:11.0},{&quot;n&quot;:&quot;CourierNewPS-ItalicMT&quot;,&quot;x&quot;:0.055017,&quot;y&quot;:0.047732,&quot;g&quot;:2280,&quot;sp&quot;:13.2},{&quot;n&quot;:&quot;Avenir-Medium&quot;,&quot;x&quot;:0.05362,&quot;y&quot;:0.046465,&quot;g&quot;:815,&quot;sp&quot;:13.3},{&quot;n&quot;:&quot;ArialNarrow-BoldItalic&quot;,&quot;x&quot;:0.051936,&quot;y&quot;:0.043589,&quot;g&quot;:663,&quot;sp&quot;:16.1},{&quot;n&quot;:&quot;Avenir-Roman&quot;,&quot;x&quot;:0.051818,&quot;y&quot;:0.044378,&quot;g&quot;:816,&quot;sp&quot;:14.4},{&quot;n&quot;:&quot;ArialNarrow-Italic&quot;,&quot;x&quot;:0.051688,&quot;y&quot;:0.043874,&quot;g&quot;:663,&quot;sp&quot;:15.1},{&quot;n&quot;:&quot;Charter-Black&quot;,&quot;x&quot;:0.050507,&quot;y&quot;:0.043451,&quot;g&quot;:261,&quot;sp&quot;:14.0},{&quot;n&quot;:&quot;ArialNarrow-Bold&quot;,&quot;x&quot;:0.05,&quot;y&quot;:0.043854,&quot;g&quot;:664,&quot;sp&quot;:12.3},{&quot;n&quot;:&quot;Tahoma-Bold&quot;,&quot;x&quot;:0.049585,&quot;y&quot;:0.040205,&quot;g&quot;:3301,&quot;sp&quot;:18.9},{&quot;n&quot;:&quot;Courier-Oblique&quot;,&quot;x&quot;:0.049568,&quot;y&quot;:0.016777,&quot;g&quot;:1343,&quot;sp&quot;:66.2},{&quot;n&quot;:&quot;Impact&quot;,&quot;x&quot;:0.04911,&quot;y&quot;:0.042869,&quot;g&quot;:666,&quot;sp&quot;:12.7},{&quot;n&quot;:&quot;Times-Roman&quot;,&quot;x&quot;:0.0473,&quot;y&quot;:0.041649,&quot;g&quot;:1443,&quot;sp&quot;:11.9},{&quot;n&quot;:&quot;ArialNarrow&quot;,&quot;x&quot;:0.046998,&quot;y&quot;:0.04069,&quot;g&quot;:663,&quot;sp&quot;:13.4},{&quot;n&quot;:&quot;Superclarendon-BlackItalic&quot;,&quot;x&quot;:0.045956,&quot;y&quot;:0.041393,&quot;g&quot;:502,&quot;sp&quot;:9.9},{&quot;n&quot;:&quot;Wingdings-Regular&quot;,&quot;x&quot;:0.045833,&quot;y&quot;:0.039756,&quot;g&quot;:226,&quot;sp&quot;:13.3},{&quot;n&quot;:&quot;Arial-ItalicMT&quot;,&quot;x&quot;:0.044708,&quot;y&quot;:0.038738,&quot;g&quot;:2516,&quot;sp&quot;:13.4},{&quot;n&quot;:&quot;Menlo-Bold&quot;,&quot;x&quot;:0.044329,&quot;y&quot;:0.037158,&quot;g&quot;:2968,&quot;sp&quot;:16.2},{&quot;n&quot;:&quot;Menlo-Italic&quot;,&quot;x&quot;:0.044297,&quot;y&quot;:0.03643,&quot;g&quot;:2490,&quot;sp&quot;:17.8},{&quot;n&quot;:&quot;GillSans&quot;,&quot;x&quot;:0.044131,&quot;y&quot;:0.036808,&quot;g&quot;:423,&quot;sp&quot;:16.6},{&quot;n&quot;:&quot;Georgia-Italic&quot;,&quot;x&quot;:0.043838,&quot;y&quot;:0.036109,&quot;g&quot;:1134,&quot;sp&quot;:17.6},{&quot;n&quot;:&quot;Georgia-BoldItalic&quot;,&quot;x&quot;:0.042667,&quot;y&quot;:0.035388,&quot;g&quot;:1134,&quot;sp&quot;:17.1},{&quot;n&quot;:&quot;HelveticaNeue-Medium&quot;,&quot;x&quot;:0.04226,&quot;y&quot;:0.037531,&quot;g&quot;:1264,&quot;sp&quot;:11.2},{&quot;n&quot;:&quot;Tahoma&quot;,&quot;x&quot;:0.042233,&quot;y&quot;:0.034585,&quot;g&quot;:3301,&quot;sp&quot;:18.1},{&quot;n&quot;:&quot;Superclarendon-Black&quot;,&quot;x&quot;:0.042094,&quot;y&quot;:0.037946,&quot;g&quot;:1811,&quot;sp&quot;:9.9},{&quot;n&quot;:&quot;Charter-BlackItalic&quot;,&quot;x&quot;:0.042079,&quot;y&quot;:0.035468,&quot;g&quot;:261,&quot;sp&quot;:15.7},{&quot;n&quot;:&quot;AlBayan-Bold&quot;,&quot;x&quot;:0.042052,&quot;y&quot;:0.037408,&quot;g&quot;:279,&quot;sp&quot;:11.0},{&quot;n&quot;:&quot;AlBayan&quot;,&quot;x&quot;:0.04185,&quot;y&quot;:0.036713,&quot;g&quot;:279,&quot;sp&quot;:12.3},{&quot;n&quot;:&quot;Georgia&quot;,&quot;x&quot;:0.041822,&quot;y&quot;:0.034156,&quot;g&quot;:1134,&quot;sp&quot;:18.3},{&quot;n&quot;:&quot;Wingdings2&quot;,&quot;x&quot;:0.041549,&quot;y&quot;:0.036337,&quot;g&quot;:220,&quot;sp&quot;:12.5},{&quot;n&quot;:&quot;Georgia-Bold&quot;,&quot;x&quot;:0.041307,&quot;y&quot;:0.03351,&quot;g&quot;:1134,&quot;sp&quot;:18.9},{&quot;n&quot;:&quot;NotoSansOriya-Bold&quot;,&quot;x&quot;:0.04076,&quot;y&quot;:0.032387,&quot;g&quot;:671,&quot;sp&quot;:20.5},{&quot;n&quot;:&quot;Verdana-BoldItalic&quot;,&quot;x&quot;:0.040485,&quot;y&quot;:0.032833,&quot;g&quot;:913,&quot;sp&quot;:18.9},{&quot;n&quot;:&quot;TrebuchetMS&quot;,&quot;x&quot;:0.040257,&quot;y&quot;:0.034193,&quot;g&quot;:581,&quot;sp&quot;:15.1},{&quot;n&quot;:&quot;InaiMathi&quot;,&quot;x&quot;:0.039378,&quot;y&quot;:0.034108,&quot;g&quot;:404,&quot;sp&quot;:13.4},{&quot;n&quot;:&quot;Geneva&quot;,&quot;x&quot;:0.038693,&quot;y&quot;:0.030825,&quot;g&quot;:3742,&quot;sp&quot;:20.3},{&quot;n&quot;:&quot;NotoSansOriya&quot;,&quot;x&quot;:0.038181,&quot;y&quot;:0.029495,&quot;g&quot;:671,&quot;sp&quot;:22.8},{&quot;n&quot;:&quot;Arial-Black&quot;,&quot;x&quot;:0.038083,&quot;y&quot;:0.032999,&quot;g&quot;:674,&quot;sp&quot;:13.3},{&quot;n&quot;:&quot;Monaco&quot;,&quot;x&quot;:0.037628,&quot;y&quot;:0.033254,&quot;g&quot;:1678,&quot;sp&quot;:11.6},{&quot;n&quot;:&quot;InaiMathi-Bold&quot;,&quot;x&quot;:0.037608,&quot;y&quot;:0.032479,&quot;g&quot;:332,&quot;sp&quot;:13.6},{&quot;n&quot;:&quot;Superclarendon-LightItalic&quot;,&quot;x&quot;:0.037581,&quot;y&quot;:0.034432,&quot;g&quot;:502,&quot;sp&quot;:8.4},{&quot;n&quot;:&quot;Verdana-Italic&quot;,&quot;x&quot;:0.037463,&quot;y&quot;:0.031787,&quot;g&quot;:913,&quot;sp&quot;:15.2},{&quot;n&quot;:&quot;Avenir-Heavy&quot;,&quot;x&quot;:0.037181,&quot;y&quot;:0.031856,&quot;g&quot;:1014,&quot;sp&quot;:14.3},{&quot;n&quot;:&quot;HelveticaNeue-CondensedBold&quot;,&quot;x&quot;:0.034506,&quot;y&quot;:0.031205,&quot;g&quot;:1044,&quot;sp&quot;:9.6},{&quot;n&quot;:&quot;Superclarendon-Light&quot;,&quot;x&quot;:0.034182,&quot;y&quot;:0.031653,&quot;g&quot;:1814,&quot;sp&quot;:7.4},{&quot;n&quot;:&quot;Menlo-BoldItalic&quot;,&quot;x&quot;:0.034172,&quot;y&quot;:0.029008,&quot;g&quot;:2363,&quot;sp&quot;:15.1},{&quot;n&quot;:&quot;Verdana-Bold&quot;,&quot;x&quot;:0.034058,&quot;y&quot;:0.029582,&quot;g&quot;:913,&quot;sp&quot;:13.1},{&quot;n&quot;:&quot;EuphemiaUCAS&quot;,&quot;x&quot;:0.033715,&quot;y&quot;:0.031076,&quot;g&quot;:977,&quot;sp&quot;:7.8},{&quot;n&quot;:&quot;PTSerif-CaptionItalic&quot;,&quot;x&quot;:0.033368,&quot;y&quot;:0.032189,&quot;g&quot;:720,&quot;sp&quot;:3.5},{&quot;n&quot;:&quot;Luminari-Regular&quot;,&quot;x&quot;:0.032631,&quot;y&quot;:0.029986,&quot;g&quot;:1161,&quot;sp&quot;:8.1},{&quot;n&quot;:&quot;MonotypeGurmukhi&quot;,&quot;x&quot;:0.031492,&quot;y&quot;:0.022707,&quot;g&quot;:187,&quot;sp&quot;:27.9},{&quot;n&quot;:&quot;Avenir-Light&quot;,&quot;x&quot;:0.030956,&quot;y&quot;:0.027343,&quot;g&quot;:388,&quot;sp&quot;:11.7},{&quot;n&quot;:&quot;Avenir-Black&quot;,&quot;x&quot;:0.030757,&quot;y&quot;:0.026991,&quot;g&quot;:815,&quot;sp&quot;:12.2},{&quot;n&quot;:&quot;PTSerif-Caption&quot;,&quot;x&quot;:0.030728,&quot;y&quot;:0.030284,&quot;g&quot;:719,&quot;sp&quot;:1.4},{&quot;n&quot;:&quot;PTSans-Italic&quot;,&quot;x&quot;:0.03033,&quot;y&quot;:0.028809,&quot;g&quot;:719,&quot;sp&quot;:5.0},{&quot;n&quot;:&quot;MarkerFelt-Wide&quot;,&quot;x&quot;:0.029774,&quot;y&quot;:0.025898,&quot;g&quot;:733,&quot;sp&quot;:13.0},{&quot;n&quot;:&quot;HelveticaNeue-CondensedBlack&quot;,&quot;x&quot;:0.029645,&quot;y&quot;:0.026365,&quot;g&quot;:1042,&quot;sp&quot;:11.1},{&quot;n&quot;:&quot;Rockwell-BoldItalic&quot;,&quot;x&quot;:0.02964,&quot;y&quot;:0.020912,&quot;g&quot;:623,&quot;sp&quot;:29.4},{&quot;n&quot;:&quot;PTSerif-Italic&quot;,&quot;x&quot;:0.029326,&quot;y&quot;:0.027915,&quot;g&quot;:720,&quot;sp&quot;:4.8},{&quot;n&quot;:&quot;Webdings&quot;,&quot;x&quot;:0.029165,&quot;y&quot;:0.025976,&quot;g&quot;:227,&quot;sp&quot;:10.9},{&quot;n&quot;:&quot;HelveticaNeue-Light&quot;,&quot;x&quot;:0.029059,&quot;y&quot;:0.025468,&quot;g&quot;:1277,&quot;sp&quot;:12.4},{&quot;n&quot;:&quot;Rockwell-Bold&quot;,&quot;x&quot;:0.028363,&quot;y&quot;:0.021491,&quot;g&quot;:623,&quot;sp&quot;:24.2},{&quot;n&quot;:&quot;Avenir-BlackOblique&quot;,&quot;x&quot;:0.028355,&quot;y&quot;:0.024859,&quot;g&quot;:815,&quot;sp&quot;:12.3},{&quot;n&quot;:&quot;Avenir-LightOblique&quot;,&quot;x&quot;:0.028273,&quot;y&quot;:0.024784,&quot;g&quot;:388,&quot;sp&quot;:12.3},{&quot;n&quot;:&quot;Helvetica-Light&quot;,&quot;x&quot;:0.028218,&quot;y&quot;:0.025203,&quot;g&quot;:1484,&quot;sp&quot;:10.7},{&quot;n&quot;:&quot;Superclarendon-Italic&quot;,&quot;x&quot;:0.028085,&quot;y&quot;:0.026375,&quot;g&quot;:502,&quot;sp&quot;:6.1},{&quot;n&quot;:&quot;IowanOldStyle-Titling&quot;,&quot;x&quot;:0.028067,&quot;y&quot;:0.025307,&quot;g&quot;:295,&quot;sp&quot;:9.8},{&quot;n&quot;:&quot;Avenir-Oblique&quot;,&quot;x&quot;:0.027721,&quot;y&quot;:0.025104,&quot;g&quot;:388,&quot;sp&quot;:9.4},{&quot;n&quot;:&quot;Seravek-Bold&quot;,&quot;x&quot;:0.027704,&quot;y&quot;:0.024583,&quot;g&quot;:2595,&quot;sp&quot;:11.3},{&quot;n&quot;:&quot;STHeitiSC-Medium&quot;,&quot;x&quot;:0.027679,&quot;y&quot;:0.026439,&quot;g&quot;:51835,&quot;sp&quot;:4.5},{&quot;n&quot;:&quot;STHeitiTC-Medium&quot;,&quot;x&quot;:0.027593,&quot;y&quot;:0.02645,&quot;g&quot;:51835,&quot;sp&quot;:4.1},{&quot;n&quot;:&quot;Trebuchet-BoldItalic&quot;,&quot;x&quot;:0.027171,&quot;y&quot;:0.023733,&quot;g&quot;:582,&quot;sp&quot;:12.7},{&quot;n&quot;:&quot;PTSans-Regular&quot;,&quot;x&quot;:0.027047,&quot;y&quot;:0.026347,&quot;g&quot;:718,&quot;sp&quot;:2.6},{&quot;n&quot;:&quot;Verdana&quot;,&quot;x&quot;:0.027016,&quot;y&quot;:0.023929,&quot;g&quot;:913,&quot;sp&quot;:11.4},{&quot;n&quot;:&quot;TrebuchetMS-Italic&quot;,&quot;x&quot;:0.026791,&quot;y&quot;:0.021856,&quot;g&quot;:582,&quot;sp&quot;:18.4},{&quot;n&quot;:&quot;MarkerFelt-Thin&quot;,&quot;x&quot;:0.026767,&quot;y&quot;:0.025027,&quot;g&quot;:733,&quot;sp&quot;:6.5},{&quot;n&quot;:&quot;HelveticaNeue-UltraLightItalic&quot;,&quot;x&quot;:0.026756,&quot;y&quot;:0.023174,&quot;g&quot;:1167,&quot;sp&quot;:13.4},{&quot;n&quot;:&quot;ChalkboardSE-Light&quot;,&quot;x&quot;:0.026361,&quot;y&quot;:0.023963,&quot;g&quot;:1086,&quot;sp&quot;:9.1},{&quot;n&quot;:&quot;Rockwell-Italic&quot;,&quot;x&quot;:0.026347,&quot;y&quot;:0.019233,&quot;g&quot;:623,&quot;sp&quot;:27.0},{&quot;n&quot;:&quot;Seravek-BoldItalic&quot;,&quot;x&quot;:0.026237,&quot;y&quot;:0.023331,&quot;g&quot;:2515,&quot;sp&quot;:11.1},{&quot;n&quot;:&quot;Helvetica-LightOblique&quot;,&quot;x&quot;:0.026168,&quot;y&quot;:0.023359,&quot;g&quot;:1389,&quot;sp&quot;:10.7},{&quot;n&quot;:&quot;PTSans-BoldItalic&quot;,&quot;x&quot;:0.025903,&quot;y&quot;:0.023443,&quot;g&quot;:719,&quot;sp&quot;:9.5},{&quot;n&quot;:&quot;Seravek-Italic&quot;,&quot;x&quot;:0.025856,&quot;y&quot;:0.023392,&quot;g&quot;:2515,&quot;sp&quot;:9.5},{&quot;n&quot;:&quot;Rockwell-Regular&quot;,&quot;x&quot;:0.025635,&quot;y&quot;:0.020386,&quot;g&quot;:623,&quot;sp&quot;:20.5},{&quot;n&quot;:&quot;Seravek&quot;,&quot;x&quot;:0.025571,&quot;y&quot;:0.023301,&quot;g&quot;:2596,&quot;sp&quot;:8.9},{&quot;n&quot;:&quot;TrebuchetMS-Bold&quot;,&quot;x&quot;:0.025516,&quot;y&quot;:0.025052,&quot;g&quot;:581,&quot;sp&quot;:1.8},{&quot;n&quot;:&quot;STHeitiTC-Light&quot;,&quot;x&quot;:0.025317,&quot;y&quot;:0.024465,&quot;g&quot;:52268,&quot;sp&quot;:3.4},{&quot;n&quot;:&quot;STHeitiSC-Light&quot;,&quot;x&quot;:0.025222,&quot;y&quot;:0.024352,&quot;g&quot;:52268,&quot;sp&quot;:3.4},{&quot;n&quot;:&quot;ZapfDingbatsITC&quot;,&quot;x&quot;:0.024977,&quot;y&quot;:0.01914,&quot;g&quot;:208,&quot;sp&quot;:23.4},{&quot;n&quot;:&quot;ChalkboardSE-Bold&quot;,&quot;x&quot;:0.02483,&quot;y&quot;:0.021543,&quot;g&quot;:1086,&quot;sp&quot;:13.2},{&quot;n&quot;:&quot;HoeflerText-Regular&quot;,&quot;x&quot;:0.024771,&quot;y&quot;:0.02381,&quot;g&quot;:1178,&quot;sp&quot;:3.9},{&quot;n&quot;:&quot;ChalkboardSE-Regular&quot;,&quot;x&quot;:0.024699,&quot;y&quot;:0.022447,&quot;g&quot;:1086,&quot;sp&quot;:9.1},{&quot;n&quot;:&quot;ComicSansMS-Bold&quot;,&quot;x&quot;:0.024538,&quot;y&quot;:0.021738,&quot;g&quot;:587,&quot;sp&quot;:11.4},{&quot;n&quot;:&quot;PTSans-Narrow&quot;,&quot;x&quot;:0.024111,&quot;y&quot;:0.023231,&quot;g&quot;:718,&quot;sp&quot;:3.7},{&quot;n&quot;:&quot;PTSerif-BoldItalic&quot;,&quot;x&quot;:0.023995,&quot;y&quot;:0.023098,&quot;g&quot;:720,&quot;sp&quot;:3.7},{&quot;n&quot;:&quot;Superclarendon-Regular&quot;,&quot;x&quot;:0.023751,&quot;y&quot;:0.02291,&quot;g&quot;:2732,&quot;sp&quot;:3.5},{&quot;n&quot;:&quot;HelveticaNeue-UltraLight&quot;,&quot;x&quot;:0.023296,&quot;y&quot;:0.020737,&quot;g&quot;:1270,&quot;sp&quot;:11.0},{&quot;n&quot;:&quot;PTSans-Caption&quot;,&quot;x&quot;:0.023275,&quot;y&quot;:0.022338,&quot;g&quot;:718,&quot;sp&quot;:4.0},{&quot;n&quot;:&quot;PTSerif-Regular&quot;,&quot;x&quot;:0.023222,&quot;y&quot;:0.022588,&quot;g&quot;:720,&quot;sp&quot;:2.7},{&quot;n&quot;:&quot;Superclarendon-BoldItalic&quot;,&quot;x&quot;:0.023031,&quot;y&quot;:0.021898,&quot;g&quot;:502,&quot;sp&quot;:4.9},{&quot;n&quot;:&quot;Avenir-MediumOblique&quot;,&quot;x&quot;:0.022987,&quot;y&quot;:0.022006,&quot;g&quot;:388,&quot;sp&quot;:4.3},{&quot;n&quot;:&quot;PartyLetPlain&quot;,&quot;x&quot;:0.022914,&quot;y&quot;:0.022599,&quot;g&quot;:749,&quot;sp&quot;:1.4},{&quot;n&quot;:&quot;SnellRoundhand-Bold&quot;,&quot;x&quot;:0.022719,&quot;y&quot;:0.021604,&quot;g&quot;:2242,&quot;sp&quot;:4.9},{&quot;n&quot;:&quot;GurmukhiMN&quot;,&quot;x&quot;:0.022419,&quot;y&quot;:0.021347,&quot;g&quot;:377,&quot;sp&quot;:4.8},{&quot;n&quot;:&quot;PTMono-Bold&quot;,&quot;x&quot;:0.022346,&quot;y&quot;:0.022174,&quot;g&quot;:810,&quot;sp&quot;:0.8},{&quot;n&quot;:&quot;HelveticaNeue-Bold&quot;,&quot;x&quot;:0.02193,&quot;y&quot;:0.018488,&quot;g&quot;:2322,&quot;sp&quot;:15.7},{&quot;n&quot;:&quot;Wingdings3&quot;,&quot;x&quot;:0.021547,&quot;y&quot;:0.019425,&quot;g&quot;:211,&quot;sp&quot;:9.9},{&quot;n&quot;:&quot;PTMono-Regular&quot;,&quot;x&quot;:0.021494,&quot;y&quot;:0.02115,&quot;g&quot;:810,&quot;sp&quot;:1.6},{&quot;n&quot;:&quot;AmericanTypewriter&quot;,&quot;x&quot;:0.021488,&quot;y&quot;:0.022081,&quot;g&quot;:1195,&quot;sp&quot;:-2.8},{&quot;n&quot;:&quot;AmericanTypewriter-Light&quot;,&quot;x&quot;:0.021339,&quot;y&quot;:0.0214,&quot;g&quot;:1195,&quot;sp&quot;:-0.3},{&quot;n&quot;:&quot;HoeflerText-Italic&quot;,&quot;x&quot;:0.021285,&quot;y&quot;:0.014625,&quot;g&quot;:1074,&quot;sp&quot;:31.3},{&quot;n&quot;:&quot;HoeflerText-BlackItalic&quot;,&quot;x&quot;:0.021179,&quot;y&quot;:0.01515,&quot;g&quot;:1089,&quot;sp&quot;:28.5},{&quot;n&quot;:&quot;Kokonor&quot;,&quot;x&quot;:0.021044,&quot;y&quot;:0.020517,&quot;g&quot;:1351,&quot;sp&quot;:2.5},{&quot;n&quot;:&quot;PTSerif-Bold&quot;,&quot;x&quot;:0.020718,&quot;y&quot;:0.020567,&quot;g&quot;:720,&quot;sp&quot;:0.7},{&quot;n&quot;:&quot;SnellRoundhand-Black&quot;,&quot;x&quot;:0.020614,&quot;y&quot;:0.019928,&quot;g&quot;:2240,&quot;sp&quot;:3.3},{&quot;n&quot;:&quot;SnellRoundhand&quot;,&quot;x&quot;:0.020597,&quot;y&quot;:0.020377,&quot;g&quot;:2254,&quot;sp&quot;:1.1},{&quot;n&quot;:&quot;PTSans-NarrowBold&quot;,&quot;x&quot;:0.020451,&quot;y&quot;:0.019564,&quot;g&quot;:718,&quot;sp&quot;:4.3},{&quot;n&quot;:&quot;PTSans-Bold&quot;,&quot;x&quot;:0.020226,&quot;y&quot;:0.018793,&quot;g&quot;:718,&quot;sp&quot;:7.1},{&quot;n&quot;:&quot;Didot-Bold&quot;,&quot;x&quot;:0.020097,&quot;y&quot;:0.01868,&quot;g&quot;:1724,&quot;sp&quot;:7.0},{&quot;n&quot;:&quot;Athelas-Bold&quot;,&quot;x&quot;:0.019886,&quot;y&quot;:0.018269,&quot;g&quot;:1742,&quot;sp&quot;:8.1},{&quot;n&quot;:&quot;AmericanTypewriter-Condensed&quot;,&quot;x&quot;:0.019872,&quot;y&quot;:0.020305,&quot;g&quot;:1195,&quot;sp&quot;:-2.2},{&quot;n&quot;:&quot;Herculanum&quot;,&quot;x&quot;:0.019842,&quot;y&quot;:0.01968,&quot;g&quot;:386,&quot;sp&quot;:0.8},{&quot;n&quot;:&quot;GurmukhiMN-Bold&quot;,&quot;x&quot;:0.019554,&quot;y&quot;:0.019004,&quot;g&quot;:375,&quot;sp&quot;:2.8},{&quot;n&quot;:&quot;HelveticaNeue-LightItalic&quot;,&quot;x&quot;:0.018985,&quot;y&quot;:0.017808,&quot;g&quot;:1167,&quot;sp&quot;:6.2},{&quot;n&quot;:&quot;Apple-Chancery&quot;,&quot;x&quot;:0.018957,&quot;y&quot;:0.013173,&quot;g&quot;:1058,&quot;sp&quot;:30.5},{&quot;n&quot;:&quot;AmericanTypewriter-CondensedBold&quot;,&quot;x&quot;:0.018805,&quot;y&quot;:0.019324,&quot;g&quot;:1195,&quot;sp&quot;:-2.8},{&quot;n&quot;:&quot;Palatino-Roman&quot;,&quot;x&quot;:0.018561,&quot;y&quot;:0.01827,&quot;g&quot;:1756,&quot;sp&quot;:1.6},{&quot;n&quot;:&quot;Copperplate&quot;,&quot;x&quot;:0.018528,&quot;y&quot;:0.018311,&quot;g&quot;:1493,&quot;sp&quot;:1.2},{&quot;n&quot;:&quot;EuphemiaUCAS-Italic&quot;,&quot;x&quot;:0.01852,&quot;y&quot;:0.018,&quot;g&quot;:866,&quot;sp&quot;:2.8},{&quot;n&quot;:&quot;Cochin-Italic&quot;,&quot;x&quot;:0.018343,&quot;y&quot;:0.017837,&quot;g&quot;:1108,&quot;sp&quot;:2.8},{&quot;n&quot;:&quot;IowanOldStyle-Bold&quot;,&quot;x&quot;:0.018259,&quot;y&quot;:0.01836,&quot;g&quot;:2229,&quot;sp&quot;:-0.6},{&quot;n&quot;:&quot;Avenir-BookOblique&quot;,&quot;x&quot;:0.017787,&quot;y&quot;:0.018362,&quot;g&quot;:388,&quot;sp&quot;:-3.2},{&quot;n&quot;:&quot;Palatino-BoldItalic&quot;,&quot;x&quot;:0.017773,&quot;y&quot;:0.01754,&quot;g&quot;:1762,&quot;sp&quot;:1.3},{&quot;n&quot;:&quot;Avenir-Book&quot;,&quot;x&quot;:0.017714,&quot;y&quot;:0.017927,&quot;g&quot;:388,&quot;sp&quot;:-1.2},{&quot;n&quot;:&quot;Cochin-Bold&quot;,&quot;x&quot;:0.017703,&quot;y&quot;:0.017345,&quot;g&quot;:1104,&quot;sp&quot;:2.0},{&quot;n&quot;:&quot;EuphemiaUCAS-Bold&quot;,&quot;x&quot;:0.01737,&quot;y&quot;:0.017091,&quot;g&quot;:866,&quot;sp&quot;:1.6},{&quot;n&quot;:&quot;Marion-Bold&quot;,&quot;x&quot;:0.01727,&quot;y&quot;:0.017024,&quot;g&quot;:1196,&quot;sp&quot;:1.4},{&quot;n&quot;:&quot;Cochin&quot;,&quot;x&quot;:0.017266,&quot;y&quot;:0.017114,&quot;g&quot;:1104,&quot;sp&quot;:0.9},{&quot;n&quot;:&quot;Marion-Regular&quot;,&quot;x&quot;:0.017212,&quot;y&quot;:0.017302,&quot;g&quot;:1196,&quot;sp&quot;:-0.5},{&quot;n&quot;:&quot;Charter-Bold&quot;,&quot;x&quot;:0.01712,&quot;y&quot;:0.016804,&quot;g&quot;:2088,&quot;sp&quot;:1.8},{&quot;n&quot;:&quot;Athelas-Italic&quot;,&quot;x&quot;:0.016938,&quot;y&quot;:0.016363,&quot;g&quot;:1742,&quot;sp&quot;:3.4},{&quot;n&quot;:&quot;AppleMyungjo&quot;,&quot;x&quot;:0.016933,&quot;y&quot;:0.01661,&quot;g&quot;:19745,&quot;sp&quot;:1.9},{&quot;n&quot;:&quot;Athelas-BoldItalic&quot;,&quot;x&quot;:0.016808,&quot;y&quot;:0.016101,&quot;g&quot;:1742,&quot;sp&quot;:4.2},{&quot;n&quot;:&quot;Seravek-MediumItalic&quot;,&quot;x&quot;:0.016724,&quot;y&quot;:0.015696,&quot;g&quot;:901,&quot;sp&quot;:6.1},{&quot;n&quot;:&quot;Didot&quot;,&quot;x&quot;:0.016582,&quot;y&quot;:0.016013,&quot;g&quot;:474,&quot;sp&quot;:3.4},{&quot;n&quot;:&quot;Copperplate-Bold&quot;,&quot;x&quot;:0.016558,&quot;y&quot;:0.016341,&quot;g&quot;:1493,&quot;sp&quot;:1.3},{&quot;n&quot;:&quot;GillSans-UltraBold&quot;,&quot;x&quot;:0.016549,&quot;y&quot;:0.016133,&quot;g&quot;:1322,&quot;sp&quot;:2.5},{&quot;n&quot;:&quot;Superclarendon-Bold&quot;,&quot;x&quot;:0.016511,&quot;y&quot;:0.016665,&quot;g&quot;:1814,&quot;sp&quot;:-0.9},{&quot;n&quot;:&quot;HoeflerText-Ornaments&quot;,&quot;x&quot;:0.016305,&quot;y&quot;:0.0178,&quot;g&quot;:62,&quot;sp&quot;:-9.2},{&quot;n&quot;:&quot;Copperplate-Light&quot;,&quot;x&quot;:0.016251,&quot;y&quot;:0.016321,&quot;g&quot;:1493,&quot;sp&quot;:-0.4},{&quot;n&quot;:&quot;ShreeDev0714-Bold&quot;,&quot;x&quot;:0.016206,&quot;y&quot;:0.016135,&quot;g&quot;:563,&quot;sp&quot;:0.4},{&quot;n&quot;:&quot;HoeflerText-Black&quot;,&quot;x&quot;:0.016027,&quot;y&quot;:0.016348,&quot;g&quot;:925,&quot;sp&quot;:-2.0},{&quot;n&quot;:&quot;Marion-Italic&quot;,&quot;x&quot;:0.015996,&quot;y&quot;:0.015991,&quot;g&quot;:1196,&quot;sp&quot;:0.0},{&quot;n&quot;:&quot;IowanOldStyle-Roman&quot;,&quot;x&quot;:0.015996,&quot;y&quot;:0.016567,&quot;g&quot;:2229,&quot;sp&quot;:-3.6},{&quot;n&quot;:&quot;Palatino-Italic&quot;,&quot;x&quot;:0.015953,&quot;y&quot;:0.016072,&quot;g&quot;:1825,&quot;sp&quot;:-0.8},{&quot;n&quot;:&quot;Courier&quot;,&quot;x&quot;:0.015935,&quot;y&quot;:0.016289,&quot;g&quot;:1343,&quot;sp&quot;:-2.2},{&quot;n&quot;:&quot;Seravek-Medium&quot;,&quot;x&quot;:0.015863,&quot;y&quot;:0.014983,&quot;g&quot;:980,&quot;sp&quot;:5.5},{&quot;n&quot;:&quot;PTSans-CaptionBold&quot;,&quot;x&quot;:0.015776,&quot;y&quot;:0.015692,&quot;g&quot;:718,&quot;sp&quot;:0.5},{&quot;n&quot;:&quot;IowanOldStyle-BoldItalic&quot;,&quot;x&quot;:0.015515,&quot;y&quot;:0.015904,&quot;g&quot;:2202,&quot;sp&quot;:-2.5},{&quot;n&quot;:&quot;IowanOldStyle-Italic&quot;,&quot;x&quot;:0.01545,&quot;y&quot;:0.015898,&quot;g&quot;:2202,&quot;sp&quot;:-2.9},{&quot;n&quot;:&quot;AvenirNext-UltraLight&quot;,&quot;x&quot;:0.015429,&quot;y&quot;:0.016236,&quot;g&quot;:1190,&quot;sp&quot;:-5.2},{&quot;n&quot;:&quot;DamascusBold&quot;,&quot;x&quot;:0.015362,&quot;y&quot;:0.014455,&quot;g&quot;:1637,&quot;sp&quot;:5.9},{&quot;n&quot;:&quot;HelveticaNeue&quot;,&quot;x&quot;:0.015351,&quot;y&quot;:0.014214,&quot;g&quot;:2322,&quot;sp&quot;:7.4},{&quot;n&quot;:&quot;Athelas-Regular&quot;,&quot;x&quot;:0.015343,&quot;y&quot;:0.01519,&quot;g&quot;:1742,&quot;sp&quot;:1.0},{&quot;n&quot;:&quot;AppleGothic&quot;,&quot;x&quot;:0.015261,&quot;y&quot;:0.015612,&quot;g&quot;:19810,&quot;sp&quot;:-2.3},{&quot;n&quot;:&quot;AvenirNext-UltraLightItalic&quot;,&quot;x&quot;:0.015255,&quot;y&quot;:0.015465,&quot;g&quot;:1189,&quot;sp&quot;:-1.4},{&quot;n&quot;:&quot;Helvetica-BoldOblique&quot;,&quot;x&quot;:0.015175,&quot;y&quot;:0.014969,&quot;g&quot;:2196,&quot;sp&quot;:1.4},{&quot;n&quot;:&quot;Helvetica-Bold&quot;,&quot;x&quot;:0.015154,&quot;y&quot;:0.015185,&quot;g&quot;:2252,&quot;sp&quot;:-0.2},{&quot;n&quot;:&quot;AvenirNextCondensed-UltraLight&quot;,&quot;x&quot;:0.015007,&quot;y&quot;:0.015001,&quot;g&quot;:558,&quot;sp&quot;:0.0},{&quot;n&quot;:&quot;AvenirNextCondensed-Heavy&quot;,&quot;x&quot;:0.014915,&quot;y&quot;:0.014771,&quot;g&quot;:558,&quot;sp&quot;:1.0},{&quot;n&quot;:&quot;AvenirNextCondensed-UltraLightItalic&quot;,&quot;x&quot;:0.014894,&quot;y&quot;:0.014802,&quot;g&quot;:558,&quot;sp&quot;:0.6},{&quot;n&quot;:&quot;Damascus&quot;,&quot;x&quot;:0.014786,&quot;y&quot;:0.01363,&quot;g&quot;:1637,&quot;sp&quot;:7.8},{&quot;n&quot;:&quot;Courier-Bold&quot;,&quot;x&quot;:0.014755,&quot;y&quot;:0.014874,&quot;g&quot;:1343,&quot;sp&quot;:-0.8},{&quot;n&quot;:&quot;DamascusMedium&quot;,&quot;x&quot;:0.014627,&quot;y&quot;:0.0138,&quot;g&quot;:1637,&quot;sp&quot;:5.7},{&quot;n&quot;:&quot;AvenirNextCondensed-HeavyItalic&quot;,&quot;x&quot;:0.014602,&quot;y&quot;:0.014458,&quot;g&quot;:558,&quot;sp&quot;:1.0},{&quot;n&quot;:&quot;DamascusLight&quot;,&quot;x&quot;:0.014133,&quot;y&quot;:0.013432,&quot;g&quot;:1637,&quot;sp&quot;:5.0},{&quot;n&quot;:&quot;Krungthep&quot;,&quot;x&quot;:0.014015,&quot;y&quot;:0.013862,&quot;g&quot;:843,&quot;sp&quot;:1.1},{&quot;n&quot;:&quot;Charter-Roman&quot;,&quot;x&quot;:0.014004,&quot;y&quot;:0.014439,&quot;g&quot;:2092,&quot;sp&quot;:-3.1},{&quot;n&quot;:&quot;Seravek-LightItalic&quot;,&quot;x&quot;:0.013952,&quot;y&quot;:0.01374,&quot;g&quot;:901,&quot;sp&quot;:1.5},{&quot;n&quot;:&quot;BigCaslon-Medium&quot;,&quot;x&quot;:0.013912,&quot;y&quot;:0.014254,&quot;g&quot;:981,&quot;sp&quot;:-2.5},{&quot;n&quot;:&quot;AvenirNext-DemiBold&quot;,&quot;x&quot;:0.013845,&quot;y&quot;:0.013978,&quot;g&quot;:1187,&quot;sp&quot;:-1.0},{&quot;n&quot;:&quot;Silom&quot;,&quot;x&quot;:0.01382,&quot;y&quot;:0.012836,&quot;g&quot;:867,&quot;sp&quot;:7.1},{&quot;n&quot;:&quot;AvenirNext-Heavy&quot;,&quot;x&quot;:0.013637,&quot;y&quot;:0.014135,&quot;g&quot;:558,&quot;sp&quot;:-3.7},{&quot;n&quot;:&quot;AvenirNextCondensed-BoldItalic&quot;,&quot;x&quot;:0.013451,&quot;y&quot;:0.013562,&quot;g&quot;:558,&quot;sp&quot;:-0.8},{&quot;n&quot;:&quot;AvenirNext-HeavyItalic&quot;,&quot;x&quot;:0.013361,&quot;y&quot;:0.014165,&quot;g&quot;:558,&quot;sp&quot;:-6.0},{&quot;n&quot;:&quot;AvenirNext-DemiBoldItalic&quot;,&quot;x&quot;:0.013262,&quot;y&quot;:0.013207,&quot;g&quot;:1187,&quot;sp&quot;:0.4},{&quot;n&quot;:&quot;Seravek-Light&quot;,&quot;x&quot;:0.013015,&quot;y&quot;:0.012984,&quot;g&quot;:980,&quot;sp&quot;:0.2},{&quot;n&quot;:&quot;AvenirNext-Regular&quot;,&quot;x&quot;:0.012995,&quot;y&quot;:0.013225,&quot;g&quot;:1187,&quot;sp&quot;:-1.8},{&quot;n&quot;:&quot;Cochin-BoldItalic&quot;,&quot;x&quot;:0.012978,&quot;y&quot;:0.013592,&quot;g&quot;:1108,&quot;sp&quot;:-4.7},{&quot;n&quot;:&quot;AvenirNext-Medium&quot;,&quot;x&quot;:0.012849,&quot;y&quot;:0.01322,&quot;g&quot;:1187,&quot;sp&quot;:-2.9},{&quot;n&quot;:&quot;DiwanThuluth&quot;,&quot;x&quot;:0.0128,&quot;y&quot;:0.009494,&quot;g&quot;:2397,&quot;sp&quot;:25.8},{&quot;n&quot;:&quot;AvenirNext-Italic&quot;,&quot;x&quot;:0.012783,&quot;y&quot;:0.012963,&quot;g&quot;:1187,&quot;sp&quot;:-1.4},{&quot;n&quot;:&quot;AvenirNextCondensed-Medium&quot;,&quot;x&quot;:0.012723,&quot;y&quot;:0.012754,&quot;g&quot;:558,&quot;sp&quot;:-0.2},{&quot;n&quot;:&quot;Chalkboard-Bold&quot;,&quot;x&quot;:0.012693,&quot;y&quot;:0.010993,&quot;g&quot;:643,&quot;sp&quot;:13.4},{&quot;n&quot;:&quot;AvenirNextCondensed-MediumItalic&quot;,&quot;x&quot;:0.012521,&quot;y&quot;:0.012578,&quot;g&quot;:558,&quot;sp&quot;:-0.5},{&quot;n&quot;:&quot;AvenirNext-MediumItalic&quot;,&quot;x&quot;:0.012483,&quot;y&quot;:0.012595,&quot;g&quot;:1187,&quot;sp&quot;:-0.9},{&quot;n&quot;:&quot;AvenirNext-BoldItalic&quot;,&quot;x&quot;:0.012474,&quot;y&quot;:0.012767,&quot;g&quot;:1187,&quot;sp&quot;:-2.3},{&quot;n&quot;:&quot;Skia-Regular_Extended&quot;,&quot;x&quot;:0.012429,&quot;y&quot;:0.012457,&quot;g&quot;:591,&quot;sp&quot;:-0.2},{&quot;n&quot;:&quot;Chalkboard&quot;,&quot;x&quot;:0.012426,&quot;y&quot;:0.012298,&quot;g&quot;:643,&quot;sp&quot;:1.0},{&quot;n&quot;:&quot;BodoniOrnamentsITCTT&quot;,&quot;x&quot;:0.012314,&quot;y&quot;:0.01274,&quot;g&quot;:126,&quot;sp&quot;:-3.5},{&quot;n&quot;:&quot;AppleBraille-Outline8Dot&quot;,&quot;x&quot;:0.012295,&quot;y&quot;:0.013425,&quot;g&quot;:276,&quot;sp&quot;:-9.2},{&quot;n&quot;:&quot;Avenir-HeavyOblique&quot;,&quot;x&quot;:0.01216,&quot;y&quot;:0.01212,&quot;g&quot;:388,&quot;sp&quot;:0.3},{&quot;n&quot;:&quot;Skia-Regular_Condensed&quot;,&quot;x&quot;:0.012139,&quot;y&quot;:0.012419,&quot;g&quot;:591,&quot;sp&quot;:-2.3},{&quot;n&quot;:&quot;AvenirNextCondensed-Regular&quot;,&quot;x&quot;:0.012131,&quot;y&quot;:0.012593,&quot;g&quot;:1014,&quot;sp&quot;:-3.8},{&quot;n&quot;:&quot;Courier-BoldOblique&quot;,&quot;x&quot;:0.012107,&quot;y&quot;:0.012597,&quot;g&quot;:1343,&quot;sp&quot;:-4.1},{&quot;n&quot;:&quot;Skia-Regular_Light-Extended&quot;,&quot;x&quot;:0.012035,&quot;y&quot;:0.01229,&quot;g&quot;:591,&quot;sp&quot;:-2.1},{&quot;n&quot;:&quot;Skia-Regular_Light&quot;,&quot;x&quot;:0.012009,&quot;y&quot;:0.012333,&quot;g&quot;:591,&quot;sp&quot;:-2.7},{&quot;n&quot;:&quot;Skia-Regular_Light-Condensed&quot;,&quot;x&quot;:0.011998,&quot;y&quot;:0.012245,&quot;g&quot;:591,&quot;sp&quot;:-2.1},{&quot;n&quot;:&quot;Skia-Regular&quot;,&quot;x&quot;:0.011998,&quot;y&quot;:0.012248,&quot;g&quot;:591,&quot;sp&quot;:-2.1},{&quot;n&quot;:&quot;AppleBraille-Outline6Dot&quot;,&quot;x&quot;:0.011904,&quot;y&quot;:0.013626,&quot;g&quot;:276,&quot;sp&quot;:-14.5},{&quot;n&quot;:&quot;Ayuthaya&quot;,&quot;x&quot;:0.011897,&quot;y&quot;:0.011796,&quot;g&quot;:967,&quot;sp&quot;:0.8},{&quot;n&quot;:&quot;AvenirNextCondensed-DemiBold&quot;,&quot;x&quot;:0.011889,&quot;y&quot;:0.012329,&quot;g&quot;:1191,&quot;sp&quot;:-3.7},{&quot;n&quot;:&quot;Skia-Regular_Bold&quot;,&quot;x&quot;:0.011821,&quot;y&quot;:0.012136,&quot;g&quot;:591,&quot;sp&quot;:-2.7},{&quot;n&quot;:&quot;AvenirNext-Bold&quot;,&quot;x&quot;:0.01169,&quot;y&quot;:0.012441,&quot;g&quot;:1187,&quot;sp&quot;:-6.4},{&quot;n&quot;:&quot;HelveticaNeue-BoldItalic&quot;,&quot;x&quot;:0.011688,&quot;y&quot;:0.010923,&quot;g&quot;:2141,&quot;sp&quot;:6.5},{&quot;n&quot;:&quot;DamascusSemiBold&quot;,&quot;x&quot;:0.011654,&quot;y&quot;:0.012205,&quot;g&quot;:1637,&quot;sp&quot;:-4.7},{&quot;n&quot;:&quot;HelveticaNeue-Italic&quot;,&quot;x&quot;:0.011636,&quot;y&quot;:0.010314,&quot;g&quot;:2141,&quot;sp&quot;:11.4},{&quot;n&quot;:&quot;AvenirNextCondensed-Bold&quot;,&quot;x&quot;:0.011624,&quot;y&quot;:0.012042,&quot;g&quot;:558,&quot;sp&quot;:-3.6},{&quot;n&quot;:&quot;Skia-Regular_Black&quot;,&quot;x&quot;:0.011551,&quot;y&quot;:0.012198,&quot;g&quot;:591,&quot;sp&quot;:-5.6},{&quot;n&quot;:&quot;Skia-Regular_Black-Extended&quot;,&quot;x&quot;:0.01155,&quot;y&quot;:0.011823,&quot;g&quot;:591,&quot;sp&quot;:-2.4},{&quot;n&quot;:&quot;BodoniSvtyTwoITCTT-Book&quot;,&quot;x&quot;:0.011518,&quot;y&quot;:0.011692,&quot;g&quot;:1078,&quot;sp&quot;:-1.5},{&quot;n&quot;:&quot;AvenirNextCondensed-DemiBoldItalic&quot;,&quot;x&quot;:0.011446,&quot;y&quot;:0.011574,&quot;g&quot;:558,&quot;sp&quot;:-1.1},{&quot;n&quot;:&quot;AvenirNextCondensed-Italic&quot;,&quot;x&quot;:0.011365,&quot;y&quot;:0.011959,&quot;g&quot;:558,&quot;sp&quot;:-5.2},{&quot;n&quot;:&quot;Skia-Regular_Black-Condensed&quot;,&quot;x&quot;:0.011276,&quot;y&quot;:0.011754,&quot;g&quot;:591,&quot;sp&quot;:-4.2},{&quot;n&quot;:&quot;HelveticaNeue-MediumItalic&quot;,&quot;x&quot;:0.011242,&quot;y&quot;:0.011571,&quot;g&quot;:1046,&quot;sp&quot;:-2.9},{&quot;n&quot;:&quot;HelveticaNeue-ThinItalic&quot;,&quot;x&quot;:0.011235,&quot;y&quot;:0.011958,&quot;g&quot;:1093,&quot;sp&quot;:-6.4},{&quot;n&quot;:&quot;Seravek-ExtraLight&quot;,&quot;x&quot;:0.011177,&quot;y&quot;:0.011499,&quot;g&quot;:980,&quot;sp&quot;:-2.9},{&quot;n&quot;:&quot;Seravek-ExtraLightItalic&quot;,&quot;x&quot;:0.011131,&quot;y&quot;:0.0114,&quot;g&quot;:901,&quot;sp&quot;:-2.4},{&quot;n&quot;:&quot;HelveticaNeue-Thin&quot;,&quot;x&quot;:0.010834,&quot;y&quot;:0.011138,&quot;g&quot;:1345,&quot;sp&quot;:-2.8},{&quot;n&quot;:&quot;Baghdad&quot;,&quot;x&quot;:0.010714,&quot;y&quot;:0.010077,&quot;g&quot;:277,&quot;sp&quot;:5.9},{&quot;n&quot;:&quot;MshtakanOblique&quot;,&quot;x&quot;:0.010679,&quot;y&quot;:0.010013,&quot;g&quot;:178,&quot;sp&quot;:6.2},{&quot;n&quot;:&quot;ShreeDev0714-BoldItalic&quot;,&quot;x&quot;:0.010539,&quot;y&quot;:0.010903,&quot;g&quot;:563,&quot;sp&quot;:-3.5},{&quot;n&quot;:&quot;BodoniSvtyTwoITCTT-Bold&quot;,&quot;x&quot;:0.010449,&quot;y&quot;:0.011091,&quot;g&quot;:770,&quot;sp&quot;:-6.1},{&quot;n&quot;:&quot;BodoniSvtyTwoOSITCTT-Bold&quot;,&quot;x&quot;:0.010165,&quot;y&quot;:0.010685,&quot;g&quot;:248,&quot;sp&quot;:-5.1},{&quot;n&quot;:&quot;BodoniSvtyTwoITCTT-BookIta&quot;,&quot;x&quot;:0.009719,&quot;y&quot;:0.010554,&quot;g&quot;:770,&quot;sp&quot;:-8.6},{&quot;n&quot;:&quot;BodoniSvtyTwoSCITCTT-Book&quot;,&quot;x&quot;:0.009633,&quot;y&quot;:0.009108,&quot;g&quot;:248,&quot;sp&quot;:5.5},{&quot;n&quot;:&quot;BodoniSvtyTwoOSITCTT-BookIt&quot;,&quot;x&quot;:0.008755,&quot;y&quot;:0.010344,&quot;g&quot;:248,&quot;sp&quot;:-18.2},{&quot;n&quot;:&quot;AppleBraille-Pinpoint6Dot&quot;,&quot;x&quot;:0.008752,&quot;y&quot;:0.009887,&quot;g&quot;:276,&quot;sp&quot;:-13.0},{&quot;n&quot;:&quot;AppleBraille-Pinpoint8Dot&quot;,&quot;x&quot;:0.008634,&quot;y&quot;:0.010248,&quot;g&quot;:276,&quot;sp&quot;:-18.7},{&quot;n&quot;:&quot;AppleBraille&quot;,&quot;x&quot;:0.008464,&quot;y&quot;:0.009682,&quot;g&quot;:276,&quot;sp&quot;:-14.4},{&quot;n&quot;:&quot;BodoniSvtyTwoOSITCTT-Book&quot;,&quot;x&quot;:0.008437,&quot;y&quot;:0.009253,&quot;g&quot;:248,&quot;sp&quot;:-9.7},{&quot;n&quot;:&quot;DiwanMishafi&quot;,&quot;x&quot;:0.00814,&quot;y&quot;:0.01017,&quot;g&quot;:4154,&quot;sp&quot;:-24.9},{&quot;n&quot;:&quot;Sathu&quot;,&quot;x&quot;:0.008101,&quot;y&quot;:0.009018,&quot;g&quot;:1071,&quot;sp&quot;:-11.3},{&quot;n&quot;:&quot;Didot-Italic&quot;,&quot;x&quot;:0.006688,&quot;y&quot;:0.008204,&quot;g&quot;:406,&quot;sp&quot;:-22.7},{&quot;n&quot;:&quot;MshtakanBoldOblique&quot;,&quot;x&quot;:0.006569,&quot;y&quot;:0.006301,&quot;g&quot;:178,&quot;sp&quot;:4.1},{&quot;n&quot;:&quot;DecoTypeNaskh&quot;,&quot;x&quot;:0.006534,&quot;y&quot;:0.007561,&quot;g&quot;:274,&quot;sp&quot;:-15.7},{&quot;n&quot;:&quot;Waseem&quot;,&quot;x&quot;:0.005591,&quot;y&quot;:0.007097,&quot;g&quot;:546,&quot;sp&quot;:-26.9},{&quot;n&quot;:&quot;WaseemLight&quot;,&quot;x&quot;:0.005521,&quot;y&quot;:0.007181,&quot;g&quot;:546,&quot;sp&quot;:-30.1},{&quot;n&quot;:&quot;MshtakanBold&quot;,&quot;x&quot;:0.004643,&quot;y&quot;:0.005979,&quot;g&quot;:178,&quot;sp&quot;:-28.8},{&quot;n&quot;:&quot;ShreeDev0714&quot;,&quot;x&quot;:0.002025,&quot;y&quot;:0.002973,&quot;g&quot;:563,&quot;sp&quot;:-46.8},{&quot;n&quot;:&quot;ShreeDev0714-Italic&quot;,&quot;x&quot;:0.00198,&quot;y&quot;:0.002864,&quot;g&quot;:563,&quot;sp&quot;:-44.6},{&quot;n&quot;:&quot;Farisi&quot;,&quot;x&quot;:0.00082,&quot;y&quot;:0.001295,&quot;g&quot;:1330,&quot;sp&quot;:-58.0},{&quot;n&quot;:&quot;NotoSansNagMundari-Regular&quot;,&quot;x&quot;:0.000805,&quot;y&quot;:0.001291,&quot;g&quot;:66,&quot;sp&quot;:-60.5},{&quot;n&quot;:&quot;STIXTwoText&quot;,&quot;x&quot;:0.000804,&quot;y&quot;:0.001329,&quot;g&quot;:2221,&quot;sp&quot;:-65.3},{&quot;n&quot;:&quot;NotoSansSyriac-Regular_Thin&quot;,&quot;x&quot;:0.000802,&quot;y&quot;:0.001411,&quot;g&quot;:288,&quot;sp&quot;:-76.0},{&quot;n&quot;:&quot;STIXTwoText-Italic&quot;,&quot;x&quot;:0.000801,&quot;y&quot;:0.00131,&quot;g&quot;:2238,&quot;sp&quot;:-63.5},{&quot;n&quot;:&quot;STIXTwoText_SemiBold&quot;,&quot;x&quot;:0.000797,&quot;y&quot;:0.001288,&quot;g&quot;:2221,&quot;sp&quot;:-61.5},{&quot;n&quot;:&quot;STIXTwoText_Medium&quot;,&quot;x&quot;:0.000796,&quot;y&quot;:0.001282,&quot;g&quot;:2221,&quot;sp&quot;:-61.0},{&quot;n&quot;:&quot;STIXTwoText-Italic_Medium-Italic&quot;,&quot;x&quot;:0.000794,&quot;y&quot;:0.00132,&quot;g&quot;:2238,&quot;sp&quot;:-66.2},{&quot;n&quot;:&quot;STIXTwoText_Bold&quot;,&quot;x&quot;:0.000794,&quot;y&quot;:0.001295,&quot;g&quot;:2221,&quot;sp&quot;:-63.2},{&quot;n&quot;:&quot;NotoSansSyriac-Regular&quot;,&quot;x&quot;:0.000793,&quot;y&quot;:0.001378,&quot;g&quot;:288,&quot;sp&quot;:-73.8},{&quot;n&quot;:&quot;NotoSansSyriac-Regular_Black&quot;,&quot;x&quot;:0.000792,&quot;y&quot;:0.001307,&quot;g&quot;:288,&quot;sp&quot;:-65.0},{&quot;n&quot;:&quot;NotoSansSyriac-Regular_Medium&quot;,&quot;x&quot;:0.000792,&quot;y&quot;:0.001455,&quot;g&quot;:288,&quot;sp&quot;:-83.7},{&quot;n&quot;:&quot;STIXTwoText-Italic_SemiBold-Italic&quot;,&quot;x&quot;:0.000792,&quot;y&quot;:0.001314,&quot;g&quot;:2238,&quot;sp&quot;:-66.0},{&quot;n&quot;:&quot;NotoSansSyriac-Regular_ExtraBold&quot;,&quot;x&quot;:0.00079,&quot;y&quot;:0.00127,&quot;g&quot;:288,&quot;sp&quot;:-60.8},{&quot;n&quot;:&quot;NotoSansNagMundari-Regular_Medium&quot;,&quot;x&quot;:0.000789,&quot;y&quot;:0.001305,&quot;g&quot;:66,&quot;sp&quot;:-65.3},{&quot;n&quot;:&quot;NotoSansNagMundari-Regular_Bold&quot;,&quot;x&quot;:0.000789,&quot;y&quot;:0.001392,&quot;g&quot;:66,&quot;sp&quot;:-76.4},{&quot;n&quot;:&quot;NotoSansSyriac-Regular_ExtraLight&quot;,&quot;x&quot;:0.000789,&quot;y&quot;:0.001409,&quot;g&quot;:288,&quot;sp&quot;:-78.6},{&quot;n&quot;:&quot;NotoSansNagMundari-Regular_SemiBold&quot;,&quot;x&quot;:0.000785,&quot;y&quot;:0.001412,&quot;g&quot;:66,&quot;sp&quot;:-79.9},{&quot;n&quot;:&quot;NotoSansSyriac-Regular_Bold&quot;,&quot;x&quot;:0.000784,&quot;y&quot;:0.00135,&quot;g&quot;:288,&quot;sp&quot;:-72.2},{&quot;n&quot;:&quot;STIXTwoText-Italic_Bold-Italic&quot;,&quot;x&quot;:0.000783,&quot;y&quot;:0.001305,&quot;g&quot;:2238,&quot;sp&quot;:-66.7},{&quot;n&quot;:&quot;NotoSansSyriac-Regular_Light&quot;,&quot;x&quot;:0.000782,&quot;y&quot;:0.001384,&quot;g&quot;:288,&quot;sp&quot;:-77.0},{&quot;n&quot;:&quot;NotoSansSyriac-Regular_SemiBold&quot;,&quot;x&quot;:0.000779,&quot;y&quot;:0.001375,&quot;g&quot;:288,&quot;sp&quot;:-76.5},{&quot;n&quot;:&quot;ArialHebrew&quot;,&quot;x&quot;:0.000768,&quot;y&quot;:0.001299,&quot;g&quot;:269,&quot;sp&quot;:-69.0},{&quot;n&quot;:&quot;GillSans-SemiBold&quot;,&quot;x&quot;:0.000766,&quot;y&quot;:0.001292,&quot;g&quot;:413,&quot;sp&quot;:-68.7},{&quot;n&quot;:&quot;ArialHebrew-Bold&quot;,&quot;x&quot;:0.000761,&quot;y&quot;:0.001288,&quot;g&quot;:269,&quot;sp&quot;:-69.2},{&quot;n&quot;:&quot;ArialHebrewScholar-Bold&quot;,&quot;x&quot;:0.000761,&quot;y&quot;:0.001246,&quot;g&quot;:269,&quot;sp&quot;:-63.8},{&quot;n&quot;:&quot;GillSans-SemiBoldItalic&quot;,&quot;x&quot;:0.000756,&quot;y&quot;:0.001273,&quot;g&quot;:417,&quot;sp&quot;:-68.3},{&quot;n&quot;:&quot;ArialHebrewScholar&quot;,&quot;x&quot;:0.000756,&quot;y&quot;:0.001269,&quot;g&quot;:269,&quot;sp&quot;:-67.9},{&quot;n&quot;:&quot;ArialHebrew-Light&quot;,&quot;x&quot;:0.000755,&quot;y&quot;:0.001316,&quot;g&quot;:269,&quot;sp&quot;:-74.3},{&quot;n&quot;:&quot;ArialHebrewScholar-Light&quot;,&quot;x&quot;:0.000753,&quot;y&quot;:0.001251,&quot;g&quot;:269,&quot;sp&quot;:-66.1}];
const TP=[{&quot;n&quot;:&quot;LeelawadeeUI&quot;,&quot;x&quot;:0.10556,&quot;y&quot;:0.08676,&quot;g&quot;:1023,&quot;sp&quot;:17.8},{&quot;n&quot;:&quot;Cambria&quot;,&quot;x&quot;:0.10553,&quot;y&quot;:0.08592,&quot;g&quot;:2293,&quot;sp&quot;:18.6},{&quot;n&quot;:&quot;TimesNewRomanPS-BoldMT&quot;,&quot;x&quot;:0.0862,&quot;y&quot;:0.07121,&quot;g&quot;:4685,&quot;sp&quot;:17.4},{&quot;n&quot;:&quot;Garamond-Italic&quot;,&quot;x&quot;:0.05431,&quot;y&quot;:0.04731,&quot;g&quot;:663,&quot;sp&quot;:12.9},{&quot;n&quot;:&quot;EurostileExtended-Black&quot;,&quot;x&quot;:0.01425,&quot;y&quot;:0.01593,&quot;g&quot;:232,&quot;sp&quot;:-11.8},{&quot;n&quot;:&quot;HelveticaWorld-Bold&quot;,&quot;x&quot;:0.02195,&quot;y&quot;:0.01933,&quot;g&quot;:1867,&quot;sp&quot;:11.9},{&quot;n&quot;:&quot;hintgasp&quot;,&quot;x&quot;:0.00788,&quot;y&quot;:0.0081,&quot;g&quot;:4,&quot;sp&quot;:-2.8},{&quot;n&quot;:&quot;LiquidCrystal&quot;,&quot;x&quot;:0.00255,&quot;y&quot;:0.00351,&quot;g&quot;:399,&quot;sp&quot;:-37.6},{&quot;n&quot;:&quot;PMingLiU&quot;,&quot;x&quot;:0.11249,&quot;y&quot;:0.09469,&quot;g&quot;:22753,&quot;sp&quot;:15.8},{&quot;n&quot;:&quot;MingLiU&quot;,&quot;x&quot;:0.11207,&quot;y&quot;:0.09573,&quot;g&quot;:22753,&quot;sp&quot;:14.6},{&quot;n&quot;:&quot;SegoeUIEmoji&quot;,&quot;x&quot;:0.08489,&quot;y&quot;:0.06812,&quot;g&quot;:10145,&quot;sp&quot;:19.8},{&quot;n&quot;:&quot;SelawikVariationstest-Regular&quot;,&quot;x&quot;:0.11706,&quot;y&quot;:0.08661,&quot;g&quot;:384,&quot;sp&quot;:26.0},{&quot;n&quot;:&quot;SelawikVariationstest-Regular_Bold&quot;,&quot;x&quot;:0.11702,&quot;y&quot;:0.08714,&quot;g&quot;:384,&quot;sp&quot;:25.5},{&quot;n&quot;:&quot;SelawikVariationstest-Regular_Semibold&quot;,&quot;x&quot;:0.11691,&quot;y&quot;:0.08658,&quot;g&quot;:384,&quot;sp&quot;:25.9},{&quot;n&quot;:&quot;SelawikVariationstest-Regular_Light&quot;,&quot;x&quot;:0.1169,&quot;y&quot;:0.08723,&quot;g&quot;:384,&quot;sp&quot;:25.4},{&quot;n&quot;:&quot;SelawikVariationstest-Regular_Test&quot;,&quot;x&quot;:0.11665,&quot;y&quot;:0.08704,&quot;g&quot;:384,&quot;sp&quot;:25.4},{&quot;n&quot;:&quot;SelawikVariationstest-Regular_Semilight&quot;,&quot;x&quot;:0.11654,&quot;y&quot;:0.0873,&quot;g&quot;:384,&quot;sp&quot;:25.1},{&quot;n&quot;:&quot;Skia-Regular&quot;,&quot;x&quot;:0.01141,&quot;y&quot;:0.01177,&quot;g&quot;:128,&quot;sp&quot;:-3.2},{&quot;n&quot;:&quot;Skia-Regular_Extended&quot;,&quot;x&quot;:0.01117,&quot;y&quot;:0.01292,&quot;g&quot;:128,&quot;sp&quot;:-15.7},{&quot;n&quot;:&quot;Skia-Regular_Light&quot;,&quot;x&quot;:0.01111,&quot;y&quot;:0.01441,&quot;g&quot;:128,&quot;sp&quot;:-29.7},{&quot;n&quot;:&quot;Skia-Regular_Bold&quot;,&quot;x&quot;:0.01109,&quot;y&quot;:0.01072,&quot;g&quot;:128,&quot;sp&quot;:3.3},{&quot;n&quot;:&quot;Skia-Regular_Black&quot;,&quot;x&quot;:0.01089,&quot;y&quot;:0.01269,&quot;g&quot;:128,&quot;sp&quot;:-16.5},{&quot;n&quot;:&quot;Skia-Regular_Light-Condensed&quot;,&quot;x&quot;:0.01077,&quot;y&quot;:0.01133,&quot;g&quot;:128,&quot;sp&quot;:-5.2},{&quot;n&quot;:&quot;Skia-Regular_Condensed&quot;,&quot;x&quot;:0.01055,&quot;y&quot;:0.01583,&quot;g&quot;:128,&quot;sp&quot;:-50.0},{&quot;n&quot;:&quot;Skia-Regular_Light-Extended&quot;,&quot;x&quot;:0.0105,&quot;y&quot;:0.01192,&quot;g&quot;:128,&quot;sp&quot;:-13.5},{&quot;n&quot;:&quot;Skia-Regular_Black-Extended&quot;,&quot;x&quot;:0.01026,&quot;y&quot;:0.01123,&quot;g&quot;:128,&quot;sp&quot;:-9.5},{&quot;n&quot;:&quot;Skia-Regular_Black-Condensed&quot;,&quot;x&quot;:0.00985,&quot;y&quot;:0.01114,&quot;g&quot;:128,&quot;sp&quot;:-13.1},{&quot;n&quot;:&quot;Skia-Regular_Light&quot;,&quot;x&quot;:0.01189,&quot;y&quot;:0.01252,&quot;g&quot;:591,&quot;sp&quot;:-5.3},{&quot;n&quot;:&quot;Skia-Regular_Extended&quot;,&quot;x&quot;:0.01187,&quot;y&quot;:0.01285,&quot;g&quot;:591,&quot;sp&quot;:-8.3},{&quot;n&quot;:&quot;Skia-Regular_Light-Extended&quot;,&quot;x&quot;:0.01177,&quot;y&quot;:0.01261,&quot;g&quot;:591,&quot;sp&quot;:-7.1},{&quot;n&quot;:&quot;Skia-Regular_Condensed&quot;,&quot;x&quot;:0.01171,&quot;y&quot;:0.01265,&quot;g&quot;:591,&quot;sp&quot;:-8.0},{&quot;n&quot;:&quot;Skia-Regular_Light-Condensed&quot;,&quot;x&quot;:0.01164,&quot;y&quot;:0.01251,&quot;g&quot;:591,&quot;sp&quot;:-7.5},{&quot;n&quot;:&quot;Skia-Regular&quot;,&quot;x&quot;:0.01157,&quot;y&quot;:0.01256,&quot;g&quot;:591,&quot;sp&quot;:-8.6},{&quot;n&quot;:&quot;Skia-Regular_Black&quot;,&quot;x&quot;:0.01148,&quot;y&quot;:0.01231,&quot;g&quot;:591,&quot;sp&quot;:-7.2},{&quot;n&quot;:&quot;Skia-Regular_Bold&quot;,&quot;x&quot;:0.0113,&quot;y&quot;:0.0122,&quot;g&quot;:591,&quot;sp&quot;:-8.0},{&quot;n&quot;:&quot;Skia-Regular_Black-Extended&quot;,&quot;x&quot;:0.01121,&quot;y&quot;:0.01227,&quot;g&quot;:591,&quot;sp&quot;:-9.5},{&quot;n&quot;:&quot;Skia-Regular_Black-Condensed&quot;,&quot;x&quot;:0.01107,&quot;y&quot;:0.01199,&quot;g&quot;:591,&quot;sp&quot;:-8.3},{&quot;n&quot;:&quot;Wingdings-Regular&quot;,&quot;x&quot;:0.0454,&quot;y&quot;:0.03884,&quot;g&quot;:226,&quot;sp&quot;:14.4},{&quot;n&quot;:&quot;Avenir-Medium&quot;,&quot;x&quot;:0.05288,&quot;y&quot;:0.04671,&quot;g&quot;:815,&quot;sp&quot;:11.7},{&quot;n&quot;:&quot;Avenir-Roman&quot;,&quot;x&quot;:0.05121,&quot;y&quot;:0.04464,&quot;g&quot;:816,&quot;sp&quot;:12.8},{&quot;n&quot;:&quot;Avenir-Heavy&quot;,&quot;x&quot;:0.03688,&quot;y&quot;:0.03227,&quot;g&quot;:1014,&quot;sp&quot;:12.5},{&quot;n&quot;:&quot;Avenir-Black&quot;,&quot;x&quot;:0.03048,&quot;y&quot;:0.02698,&quot;g&quot;:815,&quot;sp&quot;:11.5},{&quot;n&quot;:&quot;Avenir-Light&quot;,&quot;x&quot;:0.03016,&quot;y&quot;:0.02762,&quot;g&quot;:388,&quot;sp&quot;:8.4},{&quot;n&quot;:&quot;Avenir-BlackOblique&quot;,&quot;x&quot;:0.0281,&quot;y&quot;:0.02492,&quot;g&quot;:815,&quot;sp&quot;:11.3},{&quot;n&quot;:&quot;Avenir-Oblique&quot;,&quot;x&quot;:0.02784,&quot;y&quot;:0.02494,&quot;g&quot;:388,&quot;sp&quot;:10.4},{&quot;n&quot;:&quot;Avenir-LightOblique&quot;,&quot;x&quot;:0.02754,&quot;y&quot;:0.02476,&quot;g&quot;:388,&quot;sp&quot;:10.1},{&quot;n&quot;:&quot;Avenir-MediumOblique&quot;,&quot;x&quot;:0.0227,&quot;y&quot;:0.02204,&quot;g&quot;:388,&quot;sp&quot;:2.9},{&quot;n&quot;:&quot;Avenir-BookOblique&quot;,&quot;x&quot;:0.0178,&quot;y&quot;:0.01837,&quot;g&quot;:388,&quot;sp&quot;:-3.2},{&quot;n&quot;:&quot;Avenir-Book&quot;,&quot;x&quot;:0.01761,&quot;y&quot;:0.01797,&quot;g&quot;:388,&quot;sp&quot;:-2.0},{&quot;n&quot;:&quot;Avenir-HeavyOblique&quot;,&quot;x&quot;:0.01209,&quot;y&quot;:0.01203,&quot;g&quot;:388,&quot;sp&quot;:0.5},{&quot;n&quot;:&quot;CompositeMac&quot;,&quot;x&quot;:0.00173,&quot;y&quot;:0.00265,&quot;g&quot;:18,&quot;sp&quot;:-53.2},{&quot;n&quot;:&quot;CompositeMS&quot;,&quot;x&quot;:0.00183,&quot;y&quot;:0.00277,&quot;g&quot;:18,&quot;sp&quot;:-51.4},{&quot;n&quot;:&quot;Courier-Bold&quot;,&quot;x&quot;:0.04845,&quot;y&quot;:0.04761,&quot;g&quot;:1343,&quot;sp&quot;:1.7},{&quot;n&quot;:&quot;RobotoFlexNormalNormalNormalNormalNormalNormalNormalNormalNormalDefault-MediumItalic&quot;,&quot;x&quot;:0.00084,&quot;y&quot;:0.00127,&quot;g&quot;:895,&quot;sp&quot;:-51.2},{&quot;n&quot;:&quot;RobotoFlexNormalNormalNormalNormalNormalNormalNormalNormalNormalDefault-Medium&quot;,&quot;x&quot;:0.00082,&quot;y&quot;:0.00127,&quot;g&quot;:895,&quot;sp&quot;:-54.9},{&quot;n&quot;:&quot;RobotoFlexNormalNormalNormalNormalNormalNormalNormalNormalNormalDefault-Bold&quot;,&quot;x&quot;:0.00082,&quot;y&quot;:0.00131,&quot;g&quot;:895,&quot;sp&quot;:-59.8},{&quot;n&quot;:&quot;RobotoFlexNormalNormalNormalNormalNormalNormalNormalNormalNormalDefault-ExtraBoldItalic&quot;,&quot;x&quot;:0.00082,&quot;y&quot;:0.00132,&quot;g&quot;:895,&quot;sp&quot;:-61.0},{&quot;n&quot;:&quot;RobotoFlexNormalNormalNormalNormalNormalNormalNormalNormalNormalDefault-ExtraLightItalic&quot;,&quot;x&quot;:0.00082,&quot;y&quot;:0.00127,&quot;g&quot;:895,&quot;sp&quot;:-54.9},{&quot;n&quot;:&quot;RobotoFlexNormalNormalNormalNormalNormalNormalNormalNormalNormalDefault-SemiBold&quot;,&quot;x&quot;:0.00082,&quot;y&quot;:0.0013,&quot;g&quot;:895,&quot;sp&quot;:-58.5},{&quot;n&quot;:&quot;RobotoFlexNormalNormalNormalNormalNormalNormalNormalNormalNormalDefault-ExtraBold&quot;,&quot;x&quot;:0.00081,&quot;y&quot;:0.00128,&quot;g&quot;:895,&quot;sp&quot;:-58.0},{&quot;n&quot;:&quot;RobotoFlexNormalNormalNormalNormalNormalNormalNormalNormalNormalDefault-BoldItalic&quot;,&quot;x&quot;:0.00081,&quot;y&quot;:0.00134,&quot;g&quot;:895,&quot;sp&quot;:-65.4},{&quot;n&quot;:&quot;RobotoFlexNormalNormalNormalNormalNormalNormalNormalNormalNormalDefault-BlackItalic&quot;,&quot;x&quot;:0.00081,&quot;y&quot;:0.00127,&quot;g&quot;:895,&quot;sp&quot;:-56.8},{&quot;n&quot;:&quot;RobotoFlexNormalNormalNormalNormalNormalNormalNormalNormalNormalDefault-ThinItalic&quot;,&quot;x&quot;:0.0008,&quot;y&quot;:0.00129,&quot;g&quot;:895,&quot;sp&quot;:-61.2},{&quot;n&quot;:&quot;RobotoFlexNormalNormalNormalNormalNormalNormalNormalNormalNormalDefault-Black&quot;,&quot;x&quot;:0.0008,&quot;y&quot;:0.00129,&quot;g&quot;:895,&quot;sp&quot;:-61.2},{&quot;n&quot;:&quot;RobotoFlexNormalNormalNormalNormalNormalNormalNormalNormalNormalDefault-LightItalic&quot;,&quot;x&quot;:0.0008,&quot;y&quot;:0.0013,&quot;g&quot;:895,&quot;sp&quot;:-62.5},{&quot;n&quot;:&quot;RobotoFlexNormalNormalNormalNormalNormalNormalNormalNormalNormalDefault-Light&quot;,&quot;x&quot;:0.0008,&quot;y&quot;:0.00126,&quot;g&quot;:895,&quot;sp&quot;:-57.5},{&quot;n&quot;:&quot;RobotoFlexNormalNormalNormalNormalNormalNormalNormalNormalNormalDefault-SemiBoldItalic&quot;,&quot;x&quot;:0.0008,&quot;y&quot;:0.00128,&quot;g&quot;:895,&quot;sp&quot;:-60.0},{&quot;n&quot;:&quot;RobotoFlexNormalNormalNormalNormalNormalNormalNormalNormalNormalDefault-ExtraBlackItalic&quot;,&quot;x&quot;:0.0008,&quot;y&quot;:0.00129,&quot;g&quot;:895,&quot;sp&quot;:-61.2},{&quot;n&quot;:&quot;RobotoFlexNormalNormalNormalNormalNormalNormalNormalNormalNormalDefault-Thin&quot;,&quot;x&quot;:0.00079,&quot;y&quot;:0.00128,&quot;g&quot;:895,&quot;sp&quot;:-62.0},{&quot;n&quot;:&quot;RobotoFlex-Regular&quot;,&quot;x&quot;:0.00079,&quot;y&quot;:0.00127,&quot;g&quot;:895,&quot;sp&quot;:-60.8},{&quot;n&quot;:&quot;RobotoFlexNormalNormalNormalNormalNormalNormalNormalNormalNormalDefault-ExtraBlack&quot;,&quot;x&quot;:0.00079,&quot;y&quot;:0.00129,&quot;g&quot;:895,&quot;sp&quot;:-63.3},{&quot;n&quot;:&quot;RobotoFlexNormalNormalNormalNormalNormalNormalNormalNormalNormalDefault-Italic&quot;,&quot;x&quot;:0.00079,&quot;y&quot;:0.00132,&quot;g&quot;:895,&quot;sp&quot;:-67.1},{&quot;n&quot;:&quot;RobotoFlexNormalNormalNormalNormalNormalNormalNormalNormalNormalDefault-ExtraLight&quot;,&quot;x&quot;:0.00079,&quot;y&quot;:0.00132,&quot;g&quot;:895,&quot;sp&quot;:-67.1}];
const LIM=0.32;
const M={l:62,r:24,t:20,b:54}, W=640, H=660;
const pw=W-M.l-M.r, ph=H-M.t-M.b;
const sx=v=&gt;M.l+v/LIM*pw, sy=v=&gt;M.t+ph-v/LIM*ph;
const fx=f=&gt;M.l+f*pw, fy=f=&gt;M.t+ph-f*ph;
const svg=document.getElementById(&apos;hinting-chart-svg&apos;), NS=&apos;http://www.w3.org/2000/svg&apos;;
function el(t,a){const e=document.createElementNS(NS,t);for(const k in a)e.setAttribute(k,a[k]);return e;}

const x0=fx(0),x1=fx(1),y0=fy(0),y1=fy(1);
svg.appendChild(el(&apos;polygon&apos;,{points:`${x0},${y0} ${x1},${y0} ${x1},${y1}`,style:&apos;fill:var(--color-syntax-other-preprocessor-macros);fill-opacity:.10&apos;}));
svg.appendChild(el(&apos;polygon&apos;,{points:`${x0},${y0} ${x0},${y1} ${x1},${y1}`,style:&apos;fill:var(--site-link-with-right-arrow-color);fill-opacity:.10&apos;}));

for(let t=0;t&lt;=0.30001;t+=0.05){
  const gx=sx(t),gy=sy(t);
  svg.appendChild(el(&apos;line&apos;,{class:&apos;grid&apos;,x1:gx,y1:y1,x2:gx,y2:y0}));
  svg.appendChild(el(&apos;line&apos;,{class:&apos;grid&apos;,x1:x0,y1:gy,x2:x1,y2:gy}));
  const tl=t.toFixed(2);
  let a=el(&apos;text&apos;,{class:&apos;ticklabel&apos;,x:gx,y:y0+16,&apos;text-anchor&apos;:&apos;middle&apos;});a.textContent=tl;svg.appendChild(a);
  let b=el(&apos;text&apos;,{class:&apos;ticklabel&apos;,x:M.l-8,y:gy+4,&apos;text-anchor&apos;:&apos;end&apos;});b.textContent=tl;svg.appendChild(b);
}
svg.appendChild(el(&apos;rect&apos;,{class:&apos;frame&apos;,x:x0,y:y1,width:pw,height:ph}));
svg.appendChild(el(&apos;line&apos;,{class:&apos;parity&apos;,x1:x0,y1:y0,x2:x1,y2:y1}));
let eqx=fx(0.83), eqy=fy(0.83)-7;
let eq=el(&apos;text&apos;,{x:eqx,y:eqy,class:&apos;ticklabel&apos;,&apos;text-anchor&apos;:&apos;middle&apos;,transform:`rotate(-45 ${eqx} ${eqy})`});eq.textContent=&apos;equal cost&apos;;svg.appendChild(eq);

function flab(fxx,fyy,txt,cssvar,sz,w,anchor){let t=el(&apos;text&apos;,{x:fx(fxx),y:fy(fyy),style:&apos;fill:var(&apos;+cssvar+&apos;)&apos;,&apos;font-size&apos;:sz,&apos;text-anchor&apos;:anchor||&apos;start&apos;});if(w)t.setAttribute(&apos;font-weight&apos;,w);t.textContent=txt;svg.appendChild(t);}
flab(0.04,0.93,&apos;C reference is faster&apos;,&apos;--blog-muted-color&apos;,16,700);
flab(0.96,0.07,&apos;Swift is faster&apos;,&apos;--blog-muted-color&apos;,16,700,&apos;end&apos;);

let ax=el(&apos;text&apos;,{class:&apos;axislabel&apos;,x:M.l+pw/2,y:H-10,&apos;text-anchor&apos;:&apos;middle&apos;});ax.textContent=&apos;Reference (C) megacycles per glyph&apos;;svg.appendChild(ax);
let ayy=M.t+ph/2;
let ay=el(&apos;text&apos;,{class:&apos;axislabel&apos;,x:16,y:ayy,&apos;text-anchor&apos;:&apos;middle&apos;,transform:`rotate(-90 16 ${ayy})`});ay.textContent=&apos;Swift megacycles per glyph&apos;;svg.appendChild(ay);

const tip=document.getElementById(&apos;hinting-chart-tip&apos;);
function plot(arr, cls){
  for(const p of arr){
    const fast=p.y&lt;p.x;
    const c=el(&apos;circle&apos;,{class:&apos;pt &apos;+cls,cx:sx(p.x),cy:sy(p.y),r:4.2});
    c.addEventListener(&apos;mousemove&apos;,e=&gt;{
      tip.innerHTML=&apos;&lt;b&gt;&apos;+p.n+&apos;&lt;/b&gt;&lt;br&gt;&apos;+
        &apos;&lt;span class=&quot;dim&quot;&gt;Reference:&lt;/span&gt; &apos;+p.x.toFixed(4)+&apos; Mc/glyph&lt;br&gt;&apos;+
        &apos;&lt;span class=&quot;dim&quot;&gt;Swift:&lt;/span&gt; &apos;+p.y.toFixed(4)+&apos; Mc/glyph&lt;br&gt;&apos;+
        &apos;&lt;span class=&quot;sp&quot;&gt;&apos;+
        (fast?(&apos;Swift &apos;+p.sp.toFixed(1)+&apos;% faster&apos;):(&apos;C &apos;+(-p.sp).toFixed(1)+&apos;% faster&apos;))+&apos;&lt;/span&gt;&apos;+
        (p.g!=null?(&apos; &lt;span class=&quot;dim&quot;&gt;&amp;middot; &apos;+p.g.toLocaleString()+&apos; glyphs&lt;/span&gt;&apos;):&apos;&apos;);
      tip.style.left=e.clientX+&apos;px&apos;; tip.style.top=e.clientY+&apos;px&apos;; tip.style.opacity=1;
    });
    c.addEventListener(&apos;mouseleave&apos;,()=&gt;tip.style.opacity=0);
    svg.appendChild(c);
  }
}
plot(SYS,&apos;sys&apos;);
plot(TP,&apos;tp&apos;);
})();
&lt;/script&gt;

&lt;p&gt;Despite the overall performance improvement, we did not optimize everything! All of the new interpreter’s internal state was written in terms of noncopyable structures that were borrowed by its operations, but the top-level type itself is an &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;@objc class&lt;/code&gt; that gets called across a module boundary from an Objective-C++ file. The hot paths are fast, and the cold paths are convenient.&lt;/p&gt;

&lt;h2 id=&quot;swift-in-practice&quot; class=&quot;header-with-anchor&quot;&gt;Swift in practice &lt;a title=&quot;Permalink for Swift in practice section&quot; href=&quot;#swift-in-practice&quot;&gt;
            &lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt; &lt;svg width=&quot;18px&quot; height=&quot;18px&quot; viewBox=&quot;0 0 14 14&quot; role=&quot;img&quot; focusable=&quot;false&quot; aria-hidden=&quot;true&quot; xmlns=&quot;http://www.w3.org/2000/svg&quot;&gt;&lt;path d=&quot;m 11.58824,9.823529 q 0,-0.294117 -0.20589,-0.499999 L 9.85294,7.794118 q -0.20588,-0.205883 -0.5,-0.205883 -0.30882,0 -0.52941,0.235295 0.0221,0.02206 0.13971,0.136029 0.11764,0.113971 0.15808,0.158088 0.0404,0.04412 0.1103,0.139706 0.0698,0.09559 0.0956,0.1875 0.0257,0.09191 0.0257,0.202206 0,0.294117 -0.20588,0.5 -0.20588,0.205882 -0.5,0.205882 -0.1103,0 -0.20221,-0.02573 Q 8.35293,9.301471 8.25733,9.231621 8.16173,9.161771 8.11763,9.121327 8.07353,9.080887 7.95954,8.963238 7.84557,8.845591 7.82351,8.823533 7.58086,9.051474 7.58086,9.360297 q 0,0.294118 0.20588,0.5 l 1.51471,1.522059 q 0.19853,0.19853 0.5,0.19853 0.29412,0 0.5,-0.191177 l 1.08088,-1.073529 q 0.20589,-0.205883 0.20589,-0.492648 z M 6.41912,4.639706 q 0,-0.294118 -0.20588,-0.5 L 4.69853,2.617647 q -0.20588,-0.205882 -0.5,-0.205882 -0.28677,0 -0.5,0.198529 L 2.61765,3.683823 q -0.20589,0.205883 -0.20589,0.492648 0,0.294117 0.20589,0.499999 l 1.52941,1.529412 q 0.19853,0.19853 0.5,0.19853 0.30882,0 0.52941,-0.227942 Q 5.15437,6.15441 5.03676,6.040441 4.91912,5.92647 4.87868,5.882353 4.83828,5.838233 4.76838,5.742647 q -0.0698,-0.09559 -0.0956,-0.1875 -0.0257,-0.09191 -0.0257,-0.202206 0,-0.294117 0.20588,-0.5 0.20588,-0.205882 0.5,-0.205882 0.1103,0 0.20221,0.02573 0.0919,0.02573 0.1875,0.09559 0.0956,0.06985 0.1397,0.110294 0.0441,0.04044 0.15809,0.158089 Q 6.15443,5.154409 6.17649,5.176467 6.41914,4.948526 6.41914,4.639703 z M 13,9.823529 q 0,0.882353 -0.625,1.492647 l -1.08088,1.07353 Q 10.68382,13 9.80147,13 q -0.88971,0 -1.5,-0.625 L 6.78676,10.852941 Q 6.17647,10.242647 6.17647,9.360294 q 0,-0.904412 0.64706,-1.536764 L 6.17647,7.176471 Q 5.54412,7.82353 4.64706,7.82353 q -0.88235,0 -1.5,-0.617648 L 1.617647,5.676471 Q 1,5.058824 1,4.176471 1,3.294118 1.625,2.683824 L 2.70588,1.610294 Q 3.31618,1 4.19853,1 q 0.88971,0 1.5,0.625 l 1.51471,1.522059 q 0.61029,0.610294 0.61029,1.492647 0,0.904412 -0.64706,1.536764 L 7.82353,6.823529 Q 8.45588,6.17647 9.35294,6.17647 q 0.88235,0 1.5,0.617648 l 1.52941,1.529411 Q 13,8.941176 13,9.823529 z&quot;/&gt;&lt;/svg&gt;
          &lt;/a&gt;&lt;/h2&gt;

&lt;p&gt;The Swift language made this project possible. Swift is memory-safe, has great ergonomics, and can be as fast as carefully written C. This makes it an excellent language for both application and systems development.&lt;/p&gt;

&lt;p&gt;Code using noncopyable types, value types, and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Span&lt;/code&gt; is both safe and fast by default, and module-private types can be used to collectively define an architecture at no additional cost. Together with exhaustive test coverage, these well-defined internal interface boundaries make refactoring substantially easier, which in turn accelerates the measure-and-fix optimization loop while minimizing the risk of introducing bugs.&lt;/p&gt;

&lt;p&gt;This migration effort has deepened our Swift expertise and given us a foundation to build on. After completing the migration, we distilled what we learned into instructions for LLM coding assistants, and have since used them successfully in other projects. LLMs have improved the efficiency of our team’s work converting C/C++ to Swift, and have proven valuable in performing the kind of code transformations used in this effort.&lt;/p&gt;

&lt;p&gt;To accompany this post, we’ve published the source code for &lt;a href=&quot;https://github.com/apple/truetype-hinting-interpreter-example&quot;&gt;the Swift TrueType hinting interpreter&lt;/a&gt; on GitHub. This is production code, intended as a reference implementation rather than an ongoing open source project. We hope seeing how these techniques work in practice helps others achieve similar results.&lt;/p&gt;
</content>
  </entry>
  
  <entry>
    <title>Announcing the Networking Workgroup</title>
    
      
        
        <author>
        
          <name>The Ecosystem Steering Group</name>
        
        </author>
      
        
        <author>
        
          <name>Franz Busch</name>
        
        </author>
      
    
    <link href="https://swift.org/blog/announcing-networking-workgroup/"/>
    <updated>2026-06-04T06:00:00-04:00</updated>
    <id>https://swift.org/blog/announcing-networking-workgroup/</id>
    <content type="html">&lt;p&gt;The Swift Ecosystem Steering Group is excited to announce the creation of the &lt;a href=&quot;/networking-workgroup/&quot;&gt;Networking workgroup&lt;/a&gt;! Workgroups are community-led efforts, formally recognized by the project, to advance key areas of Swift.&lt;/p&gt;

&lt;p&gt;The primary goal is to guide the evolution of networking libraries, protocols, and APIs in the Swift ecosystem, making networking in Swift excellent everywhere: high-level and safe by default, modular and interoperable, cross-platform, and observable.&lt;/p&gt;

&lt;p&gt;Networking is one of the most common entry points for Swift developers, and the ecosystem has matured significantly over the years. Foundational libraries like &lt;a href=&quot;https://github.com/apple/swift-nio&quot;&gt;SwiftNIO&lt;/a&gt;, &lt;a href=&quot;https://github.com/swift-server/async-http-client&quot;&gt;AsyncHTTPClient&lt;/a&gt;, and &lt;a href=&quot;https://github.com/apple/swift-http-types&quot;&gt;swift-http-types&lt;/a&gt;, alongside platform stacks such as URLSession and Network.framework, power networking across apps, servers, and beyond. The workgroup will build upon these efforts and pursue the long-term directions outlined in the &lt;a href=&quot;https://github.com/swiftlang/swift-evolution/blob/main/visions/networking.md&quot;&gt;Networking vision&lt;/a&gt;, focusing on work to:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;Define a unified networking stack with a coherent layered architecture, from shared I/O primitives at the foundation, through common protocol implementations, to ergonomic client and server APIs at the top.&lt;/li&gt;
  &lt;li&gt;Define currency types that let libraries interoperate without coupling to specific implementations, such as IP addresses, hostnames, ports, and HTTP requests and responses.&lt;/li&gt;
  &lt;li&gt;Evolve HTTP APIs by designing and guiding a modern, unified HTTP client and server API built on structured concurrency.&lt;/li&gt;
  &lt;li&gt;Guide the evolution of shared protocol implementations (TLS, HTTP/1.1, HTTP/2, HTTP/3, QUIC, WebSockets) so improvements benefit the entire ecosystem rather than being duplicated across libraries.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The new Networking workgroup joins a growing list of Swift workgroups, including the &lt;a href=&quot;/android-workgroup/&quot;&gt;Android workgroup&lt;/a&gt;, &lt;a href=&quot;/windows-workgroup/&quot;&gt;Windows workgroup&lt;/a&gt;, and &lt;a href=&quot;/build-and-packaging-workgroup/&quot;&gt;Build and Packaging workgroup&lt;/a&gt;, which were all added in the past year.&lt;/p&gt;

&lt;p&gt;To learn more and get involved:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;a href=&quot;https://forums.swift.org/t/announcing-the-networking-workgroup/87116&quot;&gt;Discuss this announcement&lt;/a&gt; on the forums, and share ideas in the &lt;a href=&quot;https://forums.swift.org/c/development/networking/129&quot;&gt;Networking&lt;/a&gt; category.&lt;/li&gt;
  &lt;li&gt;Learn more about the Networking workgroup by reading its &lt;a href=&quot;/networking-workgroup/&quot;&gt;charter&lt;/a&gt;.&lt;/li&gt;
  &lt;li&gt;The workgroup meets biweekly. A regular meeting time is being finalized and will be announced on the forums ahead of the first public meeting.
    &lt;ul&gt;
      &lt;li&gt;Workgroup membership and meetings are open to those who wish to participate, and contributors are welcome!&lt;/li&gt;
      &lt;li&gt;To receive an invite, send a message to &lt;a href=&quot;https://forums.swift.org/new-message?groupname=networking-workgroup&quot;&gt;@networking-workgroup&lt;/a&gt; on the Swift forums.&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
&lt;/ul&gt;
</content>
  </entry>
  
  <entry>
    <title>What's new in Swift: May 2026 Edition</title>
    
      
        
        <author>
        
          <name>Dave Lester</name>
        
        </author>
      
    
    <link href="https://swift.org/blog/whats-new-in-swift-may-2026/"/>
    <updated>2026-06-03T17:45:00-04:00</updated>
    <id>https://swift.org/blog/whats-new-in-swift-may-2026/</id>
    <content type="html">&lt;p&gt;Welcome to “What’s new in Swift,” a curated digest of releases, videos, and discussions in the Swift project and community.&lt;/p&gt;

&lt;p&gt;To start, we’re focusing on some of the many local meetup groups sharing Swift content:&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;Around the world, local meetup groups and conferences bring Swift developers together, and some even predate Swift itself! Many have YouTube channels where they share videos from their events, so you can tune in remotely. Let’s highlight a few.&lt;/p&gt;

  &lt;p&gt;In May the SF Swift meetup hosted a talk by Dan Federman, &lt;a href=&quot;https://vimeo.com/1195418169?autoplay=1&amp;amp;muted=1&amp;amp;stream_id=Y2xpcHN8MjM2NTA1NDQ2fGlkOmRlc2N8W10%3D&quot;&gt;Agentify Your Swift Repo&lt;/a&gt;, which covers building an agent for CI and review feedback. &lt;a href=&quot;https://www.youtube.com/@SwiftBarcelona&quot;&gt;Swift Barcelona&lt;/a&gt; has a dedicated YouTube presence, while some groups, like the new MLX India meetup, post event playlists, including a recent talk about &lt;a href=&quot;https://www.youtube.com/watch?v=EIwP73vV2a0&amp;amp;list=PLW4mt_1SMN_kQiK-HaZIoe-p5SNg8ocGU&amp;amp;index=3&quot;&gt;using MLX Swift in iOS apps&lt;/a&gt; that’s worth checking out. And there’s even a community-organized &lt;a href=&quot;https://www.youtube.com/@SwiftCommunityMeetups&quot;&gt;Swift Community Meetups YouTube channel&lt;/a&gt;, which hosts meetups online and is home to a series of cross-platform Swift talks.&lt;/p&gt;

  &lt;p&gt;These groups support developers in a few ways worth calling out:&lt;/p&gt;

  &lt;ul&gt;
    &lt;li&gt;Local community: they’re building local connections among Swift developers and organizations.&lt;/li&gt;
    &lt;li&gt;Room for experimentation: by being less formal and sometimes featuring works in progress, meetups create space to share ideas, get feedback, and learn from one another.&lt;/li&gt;
  &lt;/ul&gt;

  &lt;p&gt;I encourage more folks to get involved in their local Swift meetup. And if your group starts publishing content and videos, please share on the &lt;a href=&quot;https://forums.swift.org&quot;&gt;Swift Forums&lt;/a&gt; in the &lt;a href=&quot;https://forums.swift.org/c/community-showcase/66&quot;&gt;Community Showcase category&lt;/a&gt;.&lt;/p&gt;

  &lt;p&gt;— Dave Lester&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Now on to other news about Swift:&lt;/p&gt;

&lt;h2 id=&quot;videos-to-watch&quot; class=&quot;header-with-anchor&quot;&gt;Videos to watch &lt;a title=&quot;Permalink for Videos to watch section&quot; href=&quot;#videos-to-watch&quot;&gt;
            &lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt; &lt;svg width=&quot;18px&quot; height=&quot;18px&quot; viewBox=&quot;0 0 14 14&quot; role=&quot;img&quot; focusable=&quot;false&quot; aria-hidden=&quot;true&quot; xmlns=&quot;http://www.w3.org/2000/svg&quot;&gt;&lt;path d=&quot;m 11.58824,9.823529 q 0,-0.294117 -0.20589,-0.499999 L 9.85294,7.794118 q -0.20588,-0.205883 -0.5,-0.205883 -0.30882,0 -0.52941,0.235295 0.0221,0.02206 0.13971,0.136029 0.11764,0.113971 0.15808,0.158088 0.0404,0.04412 0.1103,0.139706 0.0698,0.09559 0.0956,0.1875 0.0257,0.09191 0.0257,0.202206 0,0.294117 -0.20588,0.5 -0.20588,0.205882 -0.5,0.205882 -0.1103,0 -0.20221,-0.02573 Q 8.35293,9.301471 8.25733,9.231621 8.16173,9.161771 8.11763,9.121327 8.07353,9.080887 7.95954,8.963238 7.84557,8.845591 7.82351,8.823533 7.58086,9.051474 7.58086,9.360297 q 0,0.294118 0.20588,0.5 l 1.51471,1.522059 q 0.19853,0.19853 0.5,0.19853 0.29412,0 0.5,-0.191177 l 1.08088,-1.073529 q 0.20589,-0.205883 0.20589,-0.492648 z M 6.41912,4.639706 q 0,-0.294118 -0.20588,-0.5 L 4.69853,2.617647 q -0.20588,-0.205882 -0.5,-0.205882 -0.28677,0 -0.5,0.198529 L 2.61765,3.683823 q -0.20589,0.205883 -0.20589,0.492648 0,0.294117 0.20589,0.499999 l 1.52941,1.529412 q 0.19853,0.19853 0.5,0.19853 0.30882,0 0.52941,-0.227942 Q 5.15437,6.15441 5.03676,6.040441 4.91912,5.92647 4.87868,5.882353 4.83828,5.838233 4.76838,5.742647 q -0.0698,-0.09559 -0.0956,-0.1875 -0.0257,-0.09191 -0.0257,-0.202206 0,-0.294117 0.20588,-0.5 0.20588,-0.205882 0.5,-0.205882 0.1103,0 0.20221,0.02573 0.0919,0.02573 0.1875,0.09559 0.0956,0.06985 0.1397,0.110294 0.0441,0.04044 0.15809,0.158089 Q 6.15443,5.154409 6.17649,5.176467 6.41914,4.948526 6.41914,4.639703 z M 13,9.823529 q 0,0.882353 -0.625,1.492647 l -1.08088,1.07353 Q 10.68382,13 9.80147,13 q -0.88971,0 -1.5,-0.625 L 6.78676,10.852941 Q 6.17647,10.242647 6.17647,9.360294 q 0,-0.904412 0.64706,-1.536764 L 6.17647,7.176471 Q 5.54412,7.82353 4.64706,7.82353 q -0.88235,0 -1.5,-0.617648 L 1.617647,5.676471 Q 1,5.058824 1,4.176471 1,3.294118 1.625,2.683824 L 2.70588,1.610294 Q 3.31618,1 4.19853,1 q 0.88971,0 1.5,0.625 l 1.51471,1.522059 q 0.61029,0.610294 0.61029,1.492647 0,0.904412 -0.64706,1.536764 L 7.82353,6.823529 Q 8.45588,6.17647 9.35294,6.17647 q 0.88235,0 1.5,0.617648 l 1.52941,1.529411 Q 13,8.941176 13,9.823529 z&quot;/&gt;&lt;/svg&gt;
          &lt;/a&gt;&lt;/h2&gt;
&lt;ul&gt;
  &lt;li&gt;Interested in using Swift for backend server development? Mohammad Azam posted a livestream recording of &lt;a href=&quot;https://www.youtube.com/watch?v=BKMaXnSK5Kc&quot;&gt;Introduction to Hummingbird&lt;/a&gt;, a walkthrough of the web framework covering installation and development basics.&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://www.youtube.com/watch?v=LaU7z77cc2s&amp;amp;t=24s&quot;&gt;Meet the Temporal Swift SDK&lt;/a&gt;, from Replay 2026, introduces the SDK that brings Temporal’s durable workflows (long-running processes that survive crashes, retries, and restarts without losing state) to Swift. The SDK recently reached its 1.0.0 release.&lt;/li&gt;
  &lt;li&gt;Sébastien Stormacq shares a great introduction to what’s possible with AWS Lambda and Swift, presenting &lt;a href=&quot;https://www.youtube.com/watch?v=qcp99G6JGIU&quot;&gt;Swift, Server-side, &amp;amp; Serverless&lt;/a&gt; on the DevStandup YouTube channel.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;community-highlights&quot; class=&quot;header-with-anchor&quot;&gt;Community highlights &lt;a title=&quot;Permalink for Community highlights section&quot; href=&quot;#community-highlights&quot;&gt;
            &lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt; &lt;svg width=&quot;18px&quot; height=&quot;18px&quot; viewBox=&quot;0 0 14 14&quot; role=&quot;img&quot; focusable=&quot;false&quot; aria-hidden=&quot;true&quot; xmlns=&quot;http://www.w3.org/2000/svg&quot;&gt;&lt;path d=&quot;m 11.58824,9.823529 q 0,-0.294117 -0.20589,-0.499999 L 9.85294,7.794118 q -0.20588,-0.205883 -0.5,-0.205883 -0.30882,0 -0.52941,0.235295 0.0221,0.02206 0.13971,0.136029 0.11764,0.113971 0.15808,0.158088 0.0404,0.04412 0.1103,0.139706 0.0698,0.09559 0.0956,0.1875 0.0257,0.09191 0.0257,0.202206 0,0.294117 -0.20588,0.5 -0.20588,0.205882 -0.5,0.205882 -0.1103,0 -0.20221,-0.02573 Q 8.35293,9.301471 8.25733,9.231621 8.16173,9.161771 8.11763,9.121327 8.07353,9.080887 7.95954,8.963238 7.84557,8.845591 7.82351,8.823533 7.58086,9.051474 7.58086,9.360297 q 0,0.294118 0.20588,0.5 l 1.51471,1.522059 q 0.19853,0.19853 0.5,0.19853 0.29412,0 0.5,-0.191177 l 1.08088,-1.073529 q 0.20589,-0.205883 0.20589,-0.492648 z M 6.41912,4.639706 q 0,-0.294118 -0.20588,-0.5 L 4.69853,2.617647 q -0.20588,-0.205882 -0.5,-0.205882 -0.28677,0 -0.5,0.198529 L 2.61765,3.683823 q -0.20589,0.205883 -0.20589,0.492648 0,0.294117 0.20589,0.499999 l 1.52941,1.529412 q 0.19853,0.19853 0.5,0.19853 0.30882,0 0.52941,-0.227942 Q 5.15437,6.15441 5.03676,6.040441 4.91912,5.92647 4.87868,5.882353 4.83828,5.838233 4.76838,5.742647 q -0.0698,-0.09559 -0.0956,-0.1875 -0.0257,-0.09191 -0.0257,-0.202206 0,-0.294117 0.20588,-0.5 0.20588,-0.205882 0.5,-0.205882 0.1103,0 0.20221,0.02573 0.0919,0.02573 0.1875,0.09559 0.0956,0.06985 0.1397,0.110294 0.0441,0.04044 0.15809,0.158089 Q 6.15443,5.154409 6.17649,5.176467 6.41914,4.948526 6.41914,4.639703 z M 13,9.823529 q 0,0.882353 -0.625,1.492647 l -1.08088,1.07353 Q 10.68382,13 9.80147,13 q -0.88971,0 -1.5,-0.625 L 6.78676,10.852941 Q 6.17647,10.242647 6.17647,9.360294 q 0,-0.904412 0.64706,-1.536764 L 6.17647,7.176471 Q 5.54412,7.82353 4.64706,7.82353 q -0.88235,0 -1.5,-0.617648 L 1.617647,5.676471 Q 1,5.058824 1,4.176471 1,3.294118 1.625,2.683824 L 2.70588,1.610294 Q 3.31618,1 4.19853,1 q 0.88971,0 1.5,0.625 l 1.51471,1.522059 q 0.61029,0.610294 0.61029,1.492647 0,0.904412 -0.64706,1.536764 L 7.82353,6.823529 Q 8.45588,6.17647 9.35294,6.17647 q 0.88235,0 1.5,0.617648 l 1.52941,1.529411 Q 13,8.941176 13,9.823529 z&quot;/&gt;&lt;/svg&gt;
          &lt;/a&gt;&lt;/h2&gt;
&lt;ul&gt;
  &lt;li&gt;Swift and WebAssembly continues to be an exciting part of the project, with regular activity shared on the Swift forums, including the most recent &lt;a href=&quot;https://forums.swift.org/t/swift-for-wasm-may-2026-updates/86981&quot;&gt;Swift for Wasm May 2026 Updates&lt;/a&gt;. And if you missed it, check out the new &lt;a href=&quot;/blog/bringing-goodnotes-to-web-with-swift/&quot;&gt;blog post by Goodnotes&lt;/a&gt; about how they brought Goodnotes to the web with Swift and WebAssembly.&lt;/li&gt;
  &lt;li&gt;The &lt;a href=&quot;https://www.swift.org/mentorship/&quot;&gt;2026 Swift Mentorship Program&lt;/a&gt; was announced, and there’s still time until June 15, 2026, to complete the interest survey to be a mentee. Working on contributions is a rewarding way to learn. And on that note, &lt;a href=&quot;https://forums.swift.org/t/gsoc-2026-accepted-projects/86398&quot;&gt;three Swift projects were accepted for GSoC 2026&lt;/a&gt;.&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://www.cocoawithlove.com/blog/matrix-multiplications-swift.html&quot;&gt;Training an LLM in Swift, Part 1&lt;/a&gt; - Matt Gallagher takes handwritten matrix multiplication for a Swift port of llm.c from 2.8 Gflop/s to 1.1 Tflop/s, a 382x speedup, using Swift 6.2’s &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;MutableSpan&lt;/code&gt; and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;InlineArray&lt;/code&gt;, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Relaxed.multiplyAdd&lt;/code&gt; from Swift Numerics, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;DispatchQueue.concurrentPerform&lt;/code&gt;, and finally AMX and Metal. A thorough tour of performance optimization in modern Swift.&lt;/li&gt;
  &lt;li&gt;Members of the community using and contributing to the VS Code Swift Extension met in May during the &lt;a href=&quot;https://forums.swift.org/t/swift-extension-community-office-hours-agenda-may-21-2026/86279/2&quot;&gt;Swift Extension Community Office Hours&lt;/a&gt;, featuring demonstrations of using Kiro and more.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;new-package-releases&quot; class=&quot;header-with-anchor&quot;&gt;New package releases &lt;a title=&quot;Permalink for New package releases section&quot; href=&quot;#new-package-releases&quot;&gt;
            &lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt; &lt;svg width=&quot;18px&quot; height=&quot;18px&quot; viewBox=&quot;0 0 14 14&quot; role=&quot;img&quot; focusable=&quot;false&quot; aria-hidden=&quot;true&quot; xmlns=&quot;http://www.w3.org/2000/svg&quot;&gt;&lt;path d=&quot;m 11.58824,9.823529 q 0,-0.294117 -0.20589,-0.499999 L 9.85294,7.794118 q -0.20588,-0.205883 -0.5,-0.205883 -0.30882,0 -0.52941,0.235295 0.0221,0.02206 0.13971,0.136029 0.11764,0.113971 0.15808,0.158088 0.0404,0.04412 0.1103,0.139706 0.0698,0.09559 0.0956,0.1875 0.0257,0.09191 0.0257,0.202206 0,0.294117 -0.20588,0.5 -0.20588,0.205882 -0.5,0.205882 -0.1103,0 -0.20221,-0.02573 Q 8.35293,9.301471 8.25733,9.231621 8.16173,9.161771 8.11763,9.121327 8.07353,9.080887 7.95954,8.963238 7.84557,8.845591 7.82351,8.823533 7.58086,9.051474 7.58086,9.360297 q 0,0.294118 0.20588,0.5 l 1.51471,1.522059 q 0.19853,0.19853 0.5,0.19853 0.29412,0 0.5,-0.191177 l 1.08088,-1.073529 q 0.20589,-0.205883 0.20589,-0.492648 z M 6.41912,4.639706 q 0,-0.294118 -0.20588,-0.5 L 4.69853,2.617647 q -0.20588,-0.205882 -0.5,-0.205882 -0.28677,0 -0.5,0.198529 L 2.61765,3.683823 q -0.20589,0.205883 -0.20589,0.492648 0,0.294117 0.20589,0.499999 l 1.52941,1.529412 q 0.19853,0.19853 0.5,0.19853 0.30882,0 0.52941,-0.227942 Q 5.15437,6.15441 5.03676,6.040441 4.91912,5.92647 4.87868,5.882353 4.83828,5.838233 4.76838,5.742647 q -0.0698,-0.09559 -0.0956,-0.1875 -0.0257,-0.09191 -0.0257,-0.202206 0,-0.294117 0.20588,-0.5 0.20588,-0.205882 0.5,-0.205882 0.1103,0 0.20221,0.02573 0.0919,0.02573 0.1875,0.09559 0.0956,0.06985 0.1397,0.110294 0.0441,0.04044 0.15809,0.158089 Q 6.15443,5.154409 6.17649,5.176467 6.41914,4.948526 6.41914,4.639703 z M 13,9.823529 q 0,0.882353 -0.625,1.492647 l -1.08088,1.07353 Q 10.68382,13 9.80147,13 q -0.88971,0 -1.5,-0.625 L 6.78676,10.852941 Q 6.17647,10.242647 6.17647,9.360294 q 0,-0.904412 0.64706,-1.536764 L 6.17647,7.176471 Q 5.54412,7.82353 4.64706,7.82353 q -0.88235,0 -1.5,-0.617648 L 1.617647,5.676471 Q 1,5.058824 1,4.176471 1,3.294118 1.625,2.683824 L 2.70588,1.610294 Q 3.31618,1 4.19853,1 q 0.88971,0 1.5,0.625 l 1.51471,1.522059 q 0.61029,0.610294 0.61029,1.492647 0,0.904412 -0.64706,1.536764 L 7.82353,6.823529 Q 8.45588,6.17647 9.35294,6.17647 q 0.88235,0 1.5,0.617648 l 1.52941,1.529411 Q 13,8.941176 13,9.823529 z&quot;/&gt;&lt;/svg&gt;
          &lt;/a&gt;&lt;/h2&gt;
&lt;ul&gt;
  &lt;li&gt;Want to build an AI agent in Swift? The &lt;a href=&quot;https://github.com/build-on-aws/swift-bedrock-library&quot;&gt;Swift Bedrock Library&lt;/a&gt; gives you a Swift library for Amazon Bedrock foundation models.&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://github.com/orchetect/swift-osc&quot;&gt;SwiftOSC&lt;/a&gt; is an Open Sound Control (OSC) toolkit written in Swift which recently became cross-platform, now supporting Apple platforms, Linux, and Android. It’s music to our ears! Steffan Andrews, who developed SwiftOSC, has also released other music-related Swift packages including &lt;a href=&quot;https://github.com/orchetect/swift-midi&quot;&gt;SwiftMIDI&lt;/a&gt; and &lt;a href=&quot;https://github.com/orchetect/swift-timecode&quot;&gt;SwiftTimecode&lt;/a&gt;.&lt;/li&gt;
  &lt;li&gt;Ordo One shipped version 1.33.0 of &lt;a href=&quot;https://github.com/ordo-one/benchmark&quot;&gt;Benchmark&lt;/a&gt;, a package for creating sophisticated Swift performance benchmarks for a &lt;a href=&quot;https://swiftpackageindex.com/ordo-one/benchmark/1.33.0/documentation/benchmark/metrics&quot;&gt;wide variety of metrics&lt;/a&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;swift-evolution&quot; class=&quot;header-with-anchor&quot;&gt;Swift Evolution &lt;a title=&quot;Permalink for Swift Evolution section&quot; href=&quot;#swift-evolution&quot;&gt;
            &lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt; &lt;svg width=&quot;18px&quot; height=&quot;18px&quot; viewBox=&quot;0 0 14 14&quot; role=&quot;img&quot; focusable=&quot;false&quot; aria-hidden=&quot;true&quot; xmlns=&quot;http://www.w3.org/2000/svg&quot;&gt;&lt;path d=&quot;m 11.58824,9.823529 q 0,-0.294117 -0.20589,-0.499999 L 9.85294,7.794118 q -0.20588,-0.205883 -0.5,-0.205883 -0.30882,0 -0.52941,0.235295 0.0221,0.02206 0.13971,0.136029 0.11764,0.113971 0.15808,0.158088 0.0404,0.04412 0.1103,0.139706 0.0698,0.09559 0.0956,0.1875 0.0257,0.09191 0.0257,0.202206 0,0.294117 -0.20588,0.5 -0.20588,0.205882 -0.5,0.205882 -0.1103,0 -0.20221,-0.02573 Q 8.35293,9.301471 8.25733,9.231621 8.16173,9.161771 8.11763,9.121327 8.07353,9.080887 7.95954,8.963238 7.84557,8.845591 7.82351,8.823533 7.58086,9.051474 7.58086,9.360297 q 0,0.294118 0.20588,0.5 l 1.51471,1.522059 q 0.19853,0.19853 0.5,0.19853 0.29412,0 0.5,-0.191177 l 1.08088,-1.073529 q 0.20589,-0.205883 0.20589,-0.492648 z M 6.41912,4.639706 q 0,-0.294118 -0.20588,-0.5 L 4.69853,2.617647 q -0.20588,-0.205882 -0.5,-0.205882 -0.28677,0 -0.5,0.198529 L 2.61765,3.683823 q -0.20589,0.205883 -0.20589,0.492648 0,0.294117 0.20589,0.499999 l 1.52941,1.529412 q 0.19853,0.19853 0.5,0.19853 0.30882,0 0.52941,-0.227942 Q 5.15437,6.15441 5.03676,6.040441 4.91912,5.92647 4.87868,5.882353 4.83828,5.838233 4.76838,5.742647 q -0.0698,-0.09559 -0.0956,-0.1875 -0.0257,-0.09191 -0.0257,-0.202206 0,-0.294117 0.20588,-0.5 0.20588,-0.205882 0.5,-0.205882 0.1103,0 0.20221,0.02573 0.0919,0.02573 0.1875,0.09559 0.0956,0.06985 0.1397,0.110294 0.0441,0.04044 0.15809,0.158089 Q 6.15443,5.154409 6.17649,5.176467 6.41914,4.948526 6.41914,4.639703 z M 13,9.823529 q 0,0.882353 -0.625,1.492647 l -1.08088,1.07353 Q 10.68382,13 9.80147,13 q -0.88971,0 -1.5,-0.625 L 6.78676,10.852941 Q 6.17647,10.242647 6.17647,9.360294 q 0,-0.904412 0.64706,-1.536764 L 6.17647,7.176471 Q 5.54412,7.82353 4.64706,7.82353 q -0.88235,0 -1.5,-0.617648 L 1.617647,5.676471 Q 1,5.058824 1,4.176471 1,3.294118 1.625,2.683824 L 2.70588,1.610294 Q 3.31618,1 4.19853,1 q 0.88971,0 1.5,0.625 l 1.51471,1.522059 q 0.61029,0.610294 0.61029,1.492647 0,0.904412 -0.64706,1.536764 L 7.82353,6.823529 Q 8.45588,6.17647 9.35294,6.17647 q 0.88235,0 1.5,0.617648 l 1.52941,1.529411 Q 13,8.941176 13,9.823529 z&quot;/&gt;&lt;/svg&gt;
          &lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;The Swift project adds new language features through the &lt;a href=&quot;https://www.swift.org/swift-evolution/&quot;&gt;Swift Evolution process&lt;/a&gt;. These are some of the proposals currently under review or recently accepted for a future Swift release.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Under active review:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;&lt;a href=&quot;https://github.com/swiftlang/swift-evolution/blob/main/proposals/0532-optional-noncopyable-improvements.md&quot;&gt;SE-0532&lt;/a&gt; &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Optional&lt;/code&gt; noncopyable improvements and generalizations - Swift’s &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Optional&lt;/code&gt; can wrap noncopyable types, but unwrapping with &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;if let&lt;/code&gt; consumes the optional, leaving it unusable afterward. This proposal adds &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;borrow()&lt;/code&gt; and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;mutate()&lt;/code&gt; to &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Optional&lt;/code&gt;, returning &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Ref&amp;lt;Wrapped&amp;gt;?&lt;/code&gt; and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;MutableRef&amp;lt;Wrapped&amp;gt;?&lt;/code&gt; to inspect or modify the payload without consuming it, and generalizes &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;map&lt;/code&gt;, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;flatMap&lt;/code&gt;, and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;unsafelyUnwrapped&lt;/code&gt; to support noncopyable wrapped types.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Recently accepted:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;&lt;a href=&quot;https://github.com/swiftlang/swift-evolution/blob/main/proposals/0528-noncopyable-continuation.md&quot;&gt;SE-0528&lt;/a&gt; &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Continuation&lt;/code&gt; Safe and Performant Async Continuations - When bridging callback-based APIs to Swift’s structured concurrency, developers today must choose between &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;UnsafeContinuation&lt;/code&gt;, where misuse is silent and undefined, and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;CheckedContinuation&lt;/code&gt;, which catches mistakes at the cost of allocation and atomic operations. This proposal adds &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Continuation&amp;lt;Success, Failure&amp;gt;&lt;/code&gt;, a &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;~Copyable&lt;/code&gt; type that makes double-resume a compile-time error and a missing resume a runtime trap, with no overhead on the fast path.&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://github.com/swiftlang/swift-evolution/blob/main/proposals/0519-ref-mutableref-types.md&quot;&gt;SE-0519&lt;/a&gt; &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Ref&lt;/code&gt; and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;MutableRef&lt;/code&gt; types for safe, first-class references - Storing a reference to part of a data structure in Swift today requires either a class, which adds heap allocation and reference-counting overhead, or &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;UnsafePointer&lt;/code&gt;, which is unsafe and requires extreme care to use properly. This proposal adds &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Ref&amp;lt;T&amp;gt;&lt;/code&gt; and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;MutableRef&amp;lt;T&amp;gt;&lt;/code&gt; to the standard library: safe types that hold shared and exclusive references to a value, usable as local variables, struct members, and generic type parameters.&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://github.com/swiftlang/swift-evolution/blob/main/proposals/testing/0024-per-test-case-repetitions.md&quot;&gt;ST-0024&lt;/a&gt; Test case repetition - Swift Testing can repeat tests for a set number of iterations, or until a specific failure/success condition is reached, which is useful for tracking down flaky failures. Currently, if any single test case triggers the condition, all tests in the target are re-run, even ones that passed. This proposal changes repetition to apply per test case and adds &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;--maximum-repetitions&lt;/code&gt; and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;--repeat-until&lt;/code&gt; flags to &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;swift test&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;
</content>
  </entry>
  
  <entry>
    <title>Bringing Goodnotes to the web with Swift and WebAssembly</title>
    
      
        
        <author>
        
          <name>Yuta Saito</name>
        
        </author>
      
    
    <link href="https://swift.org/blog/bringing-goodnotes-to-web-with-swift/"/>
    <updated>2026-06-01T08:00:00-04:00</updated>
    <id>https://swift.org/blog/bringing-goodnotes-to-web-with-swift/</id>
    <content type="html">&lt;p&gt;&lt;em&gt;Goodnotes has been helping millions of users take handwritten notes on iPad for over a decade, earning recognition as Apple’s iPad App of the Year in 2022. Today, the same Swift code that powers our iOS app also runs seamlessly in web browsers through WebAssembly, delivering the exact same ink rendering and note-taking experience users love.&lt;/em&gt;&lt;/p&gt;

&lt;div style=&quot;max-width: 500px; margin: 30px auto;&quot;&gt;
  &lt;img srcset=&quot;/assets/images/bringing-goodnotes-to-web-with-swift/goodnotes-logo-dark@2x.png 2x&quot; alt=&quot;Goodnotes Logo&quot; class=&quot;hide-light&quot; /&gt;
  &lt;img srcset=&quot;/assets/images/bringing-goodnotes-to-web-with-swift/goodnotes-logo-light@2x.png 2x&quot; alt=&quot;Goodnotes Logo&quot; class=&quot;hide-dark&quot; /&gt;
&lt;/div&gt;

&lt;p&gt;This journey demonstrates that Swift excels as a cross-platform language, running high-performance applications while sharing the same codebase. Every bug fix and improvement to Goodnotes benefits all our users simultaneously, regardless of which platform they use.&lt;/p&gt;

&lt;p&gt;After two years of development and over two years in production at Goodnotes, we’ve shown that Swift on WebAssembly is a viable, powerful approach for building complex, performance-critical web applications.&lt;/p&gt;

&lt;h2 id=&quot;why-we-chose-swift-for-the-web&quot; class=&quot;header-with-anchor&quot;&gt;Why we chose Swift for the web &lt;a title=&quot;Permalink for Why we chose Swift for the web section&quot; href=&quot;#why-we-chose-swift-for-the-web&quot;&gt;
            &lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt; &lt;svg width=&quot;18px&quot; height=&quot;18px&quot; viewBox=&quot;0 0 14 14&quot; role=&quot;img&quot; focusable=&quot;false&quot; aria-hidden=&quot;true&quot; xmlns=&quot;http://www.w3.org/2000/svg&quot;&gt;&lt;path d=&quot;m 11.58824,9.823529 q 0,-0.294117 -0.20589,-0.499999 L 9.85294,7.794118 q -0.20588,-0.205883 -0.5,-0.205883 -0.30882,0 -0.52941,0.235295 0.0221,0.02206 0.13971,0.136029 0.11764,0.113971 0.15808,0.158088 0.0404,0.04412 0.1103,0.139706 0.0698,0.09559 0.0956,0.1875 0.0257,0.09191 0.0257,0.202206 0,0.294117 -0.20588,0.5 -0.20588,0.205882 -0.5,0.205882 -0.1103,0 -0.20221,-0.02573 Q 8.35293,9.301471 8.25733,9.231621 8.16173,9.161771 8.11763,9.121327 8.07353,9.080887 7.95954,8.963238 7.84557,8.845591 7.82351,8.823533 7.58086,9.051474 7.58086,9.360297 q 0,0.294118 0.20588,0.5 l 1.51471,1.522059 q 0.19853,0.19853 0.5,0.19853 0.29412,0 0.5,-0.191177 l 1.08088,-1.073529 q 0.20589,-0.205883 0.20589,-0.492648 z M 6.41912,4.639706 q 0,-0.294118 -0.20588,-0.5 L 4.69853,2.617647 q -0.20588,-0.205882 -0.5,-0.205882 -0.28677,0 -0.5,0.198529 L 2.61765,3.683823 q -0.20589,0.205883 -0.20589,0.492648 0,0.294117 0.20589,0.499999 l 1.52941,1.529412 q 0.19853,0.19853 0.5,0.19853 0.30882,0 0.52941,-0.227942 Q 5.15437,6.15441 5.03676,6.040441 4.91912,5.92647 4.87868,5.882353 4.83828,5.838233 4.76838,5.742647 q -0.0698,-0.09559 -0.0956,-0.1875 -0.0257,-0.09191 -0.0257,-0.202206 0,-0.294117 0.20588,-0.5 0.20588,-0.205882 0.5,-0.205882 0.1103,0 0.20221,0.02573 0.0919,0.02573 0.1875,0.09559 0.0956,0.06985 0.1397,0.110294 0.0441,0.04044 0.15809,0.158089 Q 6.15443,5.154409 6.17649,5.176467 6.41914,4.948526 6.41914,4.639703 z M 13,9.823529 q 0,0.882353 -0.625,1.492647 l -1.08088,1.07353 Q 10.68382,13 9.80147,13 q -0.88971,0 -1.5,-0.625 L 6.78676,10.852941 Q 6.17647,10.242647 6.17647,9.360294 q 0,-0.904412 0.64706,-1.536764 L 6.17647,7.176471 Q 5.54412,7.82353 4.64706,7.82353 q -0.88235,0 -1.5,-0.617648 L 1.617647,5.676471 Q 1,5.058824 1,4.176471 1,3.294118 1.625,2.683824 L 2.70588,1.610294 Q 3.31618,1 4.19853,1 q 0.88971,0 1.5,0.625 l 1.51471,1.522059 q 0.61029,0.610294 0.61029,1.492647 0,0.904412 -0.64706,1.536764 L 7.82353,6.823529 Q 8.45588,6.17647 9.35294,6.17647 q 0.88235,0 1.5,0.617648 l 1.52941,1.529411 Q 13,8.941176 13,9.823529 z&quot;/&gt;&lt;/svg&gt;
          &lt;/a&gt;&lt;/h2&gt;

&lt;p&gt;When we decided to bring Goodnotes to the web in 2021, we faced a critical decision. After more than 10 years of development, we had accumulated millions of lines of Swift code that implemented countless refinements and optimizations for digital ink rendering, document synchronization, conflict resolution using Conflict-Free Replicated Data Types (CRDTs), and content search and document indexing.&lt;/p&gt;

&lt;p&gt;We need to maintain more than 60 Frames Per Second (FPS) for real-time ink rendering, which makes performance critical. A JavaScript rewrite, Flutter, or Kotlin Multiplatform would all require rewriting our entire rendering engine from scratch, a substantial undertaking that would have delayed our web launch by years and inevitably introduced behavioral differences between platforms.&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://swiftwasm.org/&quot;&gt;SwiftWasm&lt;/a&gt; emerged as the solution. This community-driven project allows Swift code to compile to WebAssembly, running in browsers with good performance. We started experimenting with SwiftWasm, building prototypes to validate the approach. Our first experiment focused on our handwriting component, a performance-critical part of Goodnotes that would serve as a good indicator of WebAssembly’s capabilities. The results were promising enough that we committed to this path.&lt;/p&gt;

&lt;p&gt;The most compelling benefit wasn’t just code reuse, but the guarantee of behavioral consistency. When users draw a stroke on their iPad and later open the same document on the web, they see exactly the same curves, the same pressure sensitivity, the same ink flow. This isn’t because we carefully reimplemented the same algorithms twice: it’s because it’s literally the same Swift code running on both platforms.&lt;/p&gt;

&lt;h2 id=&quot;technical-architecture&quot; class=&quot;header-with-anchor&quot;&gt;Technical architecture &lt;a title=&quot;Permalink for Technical architecture section&quot; href=&quot;#technical-architecture&quot;&gt;
            &lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt; &lt;svg width=&quot;18px&quot; height=&quot;18px&quot; viewBox=&quot;0 0 14 14&quot; role=&quot;img&quot; focusable=&quot;false&quot; aria-hidden=&quot;true&quot; xmlns=&quot;http://www.w3.org/2000/svg&quot;&gt;&lt;path d=&quot;m 11.58824,9.823529 q 0,-0.294117 -0.20589,-0.499999 L 9.85294,7.794118 q -0.20588,-0.205883 -0.5,-0.205883 -0.30882,0 -0.52941,0.235295 0.0221,0.02206 0.13971,0.136029 0.11764,0.113971 0.15808,0.158088 0.0404,0.04412 0.1103,0.139706 0.0698,0.09559 0.0956,0.1875 0.0257,0.09191 0.0257,0.202206 0,0.294117 -0.20588,0.5 -0.20588,0.205882 -0.5,0.205882 -0.1103,0 -0.20221,-0.02573 Q 8.35293,9.301471 8.25733,9.231621 8.16173,9.161771 8.11763,9.121327 8.07353,9.080887 7.95954,8.963238 7.84557,8.845591 7.82351,8.823533 7.58086,9.051474 7.58086,9.360297 q 0,0.294118 0.20588,0.5 l 1.51471,1.522059 q 0.19853,0.19853 0.5,0.19853 0.29412,0 0.5,-0.191177 l 1.08088,-1.073529 q 0.20589,-0.205883 0.20589,-0.492648 z M 6.41912,4.639706 q 0,-0.294118 -0.20588,-0.5 L 4.69853,2.617647 q -0.20588,-0.205882 -0.5,-0.205882 -0.28677,0 -0.5,0.198529 L 2.61765,3.683823 q -0.20589,0.205883 -0.20589,0.492648 0,0.294117 0.20589,0.499999 l 1.52941,1.529412 q 0.19853,0.19853 0.5,0.19853 0.30882,0 0.52941,-0.227942 Q 5.15437,6.15441 5.03676,6.040441 4.91912,5.92647 4.87868,5.882353 4.83828,5.838233 4.76838,5.742647 q -0.0698,-0.09559 -0.0956,-0.1875 -0.0257,-0.09191 -0.0257,-0.202206 0,-0.294117 0.20588,-0.5 0.20588,-0.205882 0.5,-0.205882 0.1103,0 0.20221,0.02573 0.0919,0.02573 0.1875,0.09559 0.0956,0.06985 0.1397,0.110294 0.0441,0.04044 0.15809,0.158089 Q 6.15443,5.154409 6.17649,5.176467 6.41914,4.948526 6.41914,4.639703 z M 13,9.823529 q 0,0.882353 -0.625,1.492647 l -1.08088,1.07353 Q 10.68382,13 9.80147,13 q -0.88971,0 -1.5,-0.625 L 6.78676,10.852941 Q 6.17647,10.242647 6.17647,9.360294 q 0,-0.904412 0.64706,-1.536764 L 6.17647,7.176471 Q 5.54412,7.82353 4.64706,7.82353 q -0.88235,0 -1.5,-0.617648 L 1.617647,5.676471 Q 1,5.058824 1,4.176471 1,3.294118 1.625,2.683824 L 2.70588,1.610294 Q 3.31618,1 4.19853,1 q 0.88971,0 1.5,0.625 l 1.51471,1.522059 q 0.61029,0.610294 0.61029,1.492647 0,0.904412 -0.64706,1.536764 L 7.82353,6.823529 Q 8.45588,6.17647 9.35294,6.17647 q 0.88235,0 1.5,0.617648 l 1.52941,1.529411 Q 13,8.941176 13,9.823529 z&quot;/&gt;&lt;/svg&gt;
          &lt;/a&gt;&lt;/h2&gt;

&lt;div style=&quot;margin: 2em auto;&quot;&gt;
  &lt;img alt=&quot;Goodnotes WebAssembly Architecture showing shared Swift code between iOS and Web platforms.&quot; src=&quot;/assets/images/bringing-goodnotes-to-web-with-swift/code-sharing.png&quot; width=&quot;840&quot; height=&quot;525&quot; style=&quot;max-width: 100%; width: 100%; height: auto; margin: auto; display: block;&quot; /&gt;
  &lt;div style=&quot;text-align: center; font-size: smaller; margin-top: 1em;&quot;&gt;Goodnotes Architecture: Shared Swift code between iOS and Web platforms.&lt;/div&gt;
&lt;/div&gt;

&lt;p&gt;Our architecture is built around a clear separation between platform-specific UI components and shared business logic. This design enables us to maintain behavioral consistency while leveraging platform-native capabilities where appropriate.&lt;/p&gt;

&lt;h3 id=&quot;shared-core-components&quot; class=&quot;header-with-anchor&quot;&gt;Shared core components &lt;a title=&quot;Permalink for Shared core components section&quot; href=&quot;#shared-core-components&quot;&gt;
            &lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt; &lt;svg width=&quot;18px&quot; height=&quot;18px&quot; viewBox=&quot;0 0 14 14&quot; role=&quot;img&quot; focusable=&quot;false&quot; aria-hidden=&quot;true&quot; xmlns=&quot;http://www.w3.org/2000/svg&quot;&gt;&lt;path d=&quot;m 11.58824,9.823529 q 0,-0.294117 -0.20589,-0.499999 L 9.85294,7.794118 q -0.20588,-0.205883 -0.5,-0.205883 -0.30882,0 -0.52941,0.235295 0.0221,0.02206 0.13971,0.136029 0.11764,0.113971 0.15808,0.158088 0.0404,0.04412 0.1103,0.139706 0.0698,0.09559 0.0956,0.1875 0.0257,0.09191 0.0257,0.202206 0,0.294117 -0.20588,0.5 -0.20588,0.205882 -0.5,0.205882 -0.1103,0 -0.20221,-0.02573 Q 8.35293,9.301471 8.25733,9.231621 8.16173,9.161771 8.11763,9.121327 8.07353,9.080887 7.95954,8.963238 7.84557,8.845591 7.82351,8.823533 7.58086,9.051474 7.58086,9.360297 q 0,0.294118 0.20588,0.5 l 1.51471,1.522059 q 0.19853,0.19853 0.5,0.19853 0.29412,0 0.5,-0.191177 l 1.08088,-1.073529 q 0.20589,-0.205883 0.20589,-0.492648 z M 6.41912,4.639706 q 0,-0.294118 -0.20588,-0.5 L 4.69853,2.617647 q -0.20588,-0.205882 -0.5,-0.205882 -0.28677,0 -0.5,0.198529 L 2.61765,3.683823 q -0.20589,0.205883 -0.20589,0.492648 0,0.294117 0.20589,0.499999 l 1.52941,1.529412 q 0.19853,0.19853 0.5,0.19853 0.30882,0 0.52941,-0.227942 Q 5.15437,6.15441 5.03676,6.040441 4.91912,5.92647 4.87868,5.882353 4.83828,5.838233 4.76838,5.742647 q -0.0698,-0.09559 -0.0956,-0.1875 -0.0257,-0.09191 -0.0257,-0.202206 0,-0.294117 0.20588,-0.5 0.20588,-0.205882 0.5,-0.205882 0.1103,0 0.20221,0.02573 0.0919,0.02573 0.1875,0.09559 0.0956,0.06985 0.1397,0.110294 0.0441,0.04044 0.15809,0.158089 Q 6.15443,5.154409 6.17649,5.176467 6.41914,4.948526 6.41914,4.639703 z M 13,9.823529 q 0,0.882353 -0.625,1.492647 l -1.08088,1.07353 Q 10.68382,13 9.80147,13 q -0.88971,0 -1.5,-0.625 L 6.78676,10.852941 Q 6.17647,10.242647 6.17647,9.360294 q 0,-0.904412 0.64706,-1.536764 L 6.17647,7.176471 Q 5.54412,7.82353 4.64706,7.82353 q -0.88235,0 -1.5,-0.617648 L 1.617647,5.676471 Q 1,5.058824 1,4.176471 1,3.294118 1.625,2.683824 L 2.70588,1.610294 Q 3.31618,1 4.19853,1 q 0.88971,0 1.5,0.625 l 1.51471,1.522059 q 0.61029,0.610294 0.61029,1.492647 0,0.904412 -0.64706,1.536764 L 7.82353,6.823529 Q 8.45588,6.17647 9.35294,6.17647 q 0.88235,0 1.5,0.617648 l 1.52941,1.529411 Q 13,8.941176 13,9.823529 z&quot;/&gt;&lt;/svg&gt;
          &lt;/a&gt;&lt;/h3&gt;

&lt;p&gt;The heart of our application consists of three main parts:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Content Rendering Engine&lt;/strong&gt;: This handles the real-time rendering of notebook content and interactive ink strokes. We use a custom rendering engine built on low-level graphics APIs: Metal on iOS and WebGL on the web. The rendering logic is almost entirely shared, with only platform abstraction layers implemented separately for each platform.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Business Logic Layer&lt;/strong&gt;: Document modeling, handwriting recognition, and document indexing are all implemented in shared Swift packages.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;View Models&lt;/strong&gt;: Core view models that handle tool interactions and user gestures are shared across platforms.&lt;/p&gt;

&lt;h3 id=&quot;code-sharing-metrics&quot; class=&quot;header-with-anchor&quot;&gt;Code sharing metrics &lt;a title=&quot;Permalink for Code sharing metrics section&quot; href=&quot;#code-sharing-metrics&quot;&gt;
            &lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt; &lt;svg width=&quot;18px&quot; height=&quot;18px&quot; viewBox=&quot;0 0 14 14&quot; role=&quot;img&quot; focusable=&quot;false&quot; aria-hidden=&quot;true&quot; xmlns=&quot;http://www.w3.org/2000/svg&quot;&gt;&lt;path d=&quot;m 11.58824,9.823529 q 0,-0.294117 -0.20589,-0.499999 L 9.85294,7.794118 q -0.20588,-0.205883 -0.5,-0.205883 -0.30882,0 -0.52941,0.235295 0.0221,0.02206 0.13971,0.136029 0.11764,0.113971 0.15808,0.158088 0.0404,0.04412 0.1103,0.139706 0.0698,0.09559 0.0956,0.1875 0.0257,0.09191 0.0257,0.202206 0,0.294117 -0.20588,0.5 -0.20588,0.205882 -0.5,0.205882 -0.1103,0 -0.20221,-0.02573 Q 8.35293,9.301471 8.25733,9.231621 8.16173,9.161771 8.11763,9.121327 8.07353,9.080887 7.95954,8.963238 7.84557,8.845591 7.82351,8.823533 7.58086,9.051474 7.58086,9.360297 q 0,0.294118 0.20588,0.5 l 1.51471,1.522059 q 0.19853,0.19853 0.5,0.19853 0.29412,0 0.5,-0.191177 l 1.08088,-1.073529 q 0.20589,-0.205883 0.20589,-0.492648 z M 6.41912,4.639706 q 0,-0.294118 -0.20588,-0.5 L 4.69853,2.617647 q -0.20588,-0.205882 -0.5,-0.205882 -0.28677,0 -0.5,0.198529 L 2.61765,3.683823 q -0.20589,0.205883 -0.20589,0.492648 0,0.294117 0.20589,0.499999 l 1.52941,1.529412 q 0.19853,0.19853 0.5,0.19853 0.30882,0 0.52941,-0.227942 Q 5.15437,6.15441 5.03676,6.040441 4.91912,5.92647 4.87868,5.882353 4.83828,5.838233 4.76838,5.742647 q -0.0698,-0.09559 -0.0956,-0.1875 -0.0257,-0.09191 -0.0257,-0.202206 0,-0.294117 0.20588,-0.5 0.20588,-0.205882 0.5,-0.205882 0.1103,0 0.20221,0.02573 0.0919,0.02573 0.1875,0.09559 0.0956,0.06985 0.1397,0.110294 0.0441,0.04044 0.15809,0.158089 Q 6.15443,5.154409 6.17649,5.176467 6.41914,4.948526 6.41914,4.639703 z M 13,9.823529 q 0,0.882353 -0.625,1.492647 l -1.08088,1.07353 Q 10.68382,13 9.80147,13 q -0.88971,0 -1.5,-0.625 L 6.78676,10.852941 Q 6.17647,10.242647 6.17647,9.360294 q 0,-0.904412 0.64706,-1.536764 L 6.17647,7.176471 Q 5.54412,7.82353 4.64706,7.82353 q -0.88235,0 -1.5,-0.617648 L 1.617647,5.676471 Q 1,5.058824 1,4.176471 1,3.294118 1.625,2.683824 L 2.70588,1.610294 Q 3.31618,1 4.19853,1 q 0.88971,0 1.5,0.625 l 1.51471,1.522059 q 0.61029,0.610294 0.61029,1.492647 0,0.904412 -0.64706,1.536764 L 7.82353,6.823529 Q 8.45588,6.17647 9.35294,6.17647 q 0.88235,0 1.5,0.617648 l 1.52941,1.529411 Q 13,8.941176 13,9.823529 z&quot;/&gt;&lt;/svg&gt;
          &lt;/a&gt;&lt;/h3&gt;

&lt;p&gt;Our codebase demonstrates significant code reuse:&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;&lt;strong&gt;Total Web Swift codebase&lt;/strong&gt;: 2.2 million lines of code&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;Shared Swift code&lt;/strong&gt;: 1.47 million lines (66% of the web app, 34% of the iOS app)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;While lines of code isn’t the best metric, these numbers reflect the substantial business logic and rendering engine that we successfully share between platforms.&lt;/p&gt;

&lt;h3 id=&quot;binary-size-and-loading&quot; class=&quot;header-with-anchor&quot;&gt;Binary size and loading &lt;a title=&quot;Permalink for Binary size and loading section&quot; href=&quot;#binary-size-and-loading&quot;&gt;
            &lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt; &lt;svg width=&quot;18px&quot; height=&quot;18px&quot; viewBox=&quot;0 0 14 14&quot; role=&quot;img&quot; focusable=&quot;false&quot; aria-hidden=&quot;true&quot; xmlns=&quot;http://www.w3.org/2000/svg&quot;&gt;&lt;path d=&quot;m 11.58824,9.823529 q 0,-0.294117 -0.20589,-0.499999 L 9.85294,7.794118 q -0.20588,-0.205883 -0.5,-0.205883 -0.30882,0 -0.52941,0.235295 0.0221,0.02206 0.13971,0.136029 0.11764,0.113971 0.15808,0.158088 0.0404,0.04412 0.1103,0.139706 0.0698,0.09559 0.0956,0.1875 0.0257,0.09191 0.0257,0.202206 0,0.294117 -0.20588,0.5 -0.20588,0.205882 -0.5,0.205882 -0.1103,0 -0.20221,-0.02573 Q 8.35293,9.301471 8.25733,9.231621 8.16173,9.161771 8.11763,9.121327 8.07353,9.080887 7.95954,8.963238 7.84557,8.845591 7.82351,8.823533 7.58086,9.051474 7.58086,9.360297 q 0,0.294118 0.20588,0.5 l 1.51471,1.522059 q 0.19853,0.19853 0.5,0.19853 0.29412,0 0.5,-0.191177 l 1.08088,-1.073529 q 0.20589,-0.205883 0.20589,-0.492648 z M 6.41912,4.639706 q 0,-0.294118 -0.20588,-0.5 L 4.69853,2.617647 q -0.20588,-0.205882 -0.5,-0.205882 -0.28677,0 -0.5,0.198529 L 2.61765,3.683823 q -0.20589,0.205883 -0.20589,0.492648 0,0.294117 0.20589,0.499999 l 1.52941,1.529412 q 0.19853,0.19853 0.5,0.19853 0.30882,0 0.52941,-0.227942 Q 5.15437,6.15441 5.03676,6.040441 4.91912,5.92647 4.87868,5.882353 4.83828,5.838233 4.76838,5.742647 q -0.0698,-0.09559 -0.0956,-0.1875 -0.0257,-0.09191 -0.0257,-0.202206 0,-0.294117 0.20588,-0.5 0.20588,-0.205882 0.5,-0.205882 0.1103,0 0.20221,0.02573 0.0919,0.02573 0.1875,0.09559 0.0956,0.06985 0.1397,0.110294 0.0441,0.04044 0.15809,0.158089 Q 6.15443,5.154409 6.17649,5.176467 6.41914,4.948526 6.41914,4.639703 z M 13,9.823529 q 0,0.882353 -0.625,1.492647 l -1.08088,1.07353 Q 10.68382,13 9.80147,13 q -0.88971,0 -1.5,-0.625 L 6.78676,10.852941 Q 6.17647,10.242647 6.17647,9.360294 q 0,-0.904412 0.64706,-1.536764 L 6.17647,7.176471 Q 5.54412,7.82353 4.64706,7.82353 q -0.88235,0 -1.5,-0.617648 L 1.617647,5.676471 Q 1,5.058824 1,4.176471 1,3.294118 1.625,2.683824 L 2.70588,1.610294 Q 3.31618,1 4.19853,1 q 0.88971,0 1.5,0.625 l 1.51471,1.522059 q 0.61029,0.610294 0.61029,1.492647 0,0.904412 -0.64706,1.536764 L 7.82353,6.823529 Q 8.45588,6.17647 9.35294,6.17647 q 0.88235,0 1.5,0.617648 l 1.52941,1.529411 Q 13,8.941176 13,9.823529 z&quot;/&gt;&lt;/svg&gt;
          &lt;/a&gt;&lt;/h3&gt;

&lt;p&gt;The final WebAssembly binary is approximately 50 MB, which compresses to 12 MB with Brotli compression. We use Service Workers for efficient caching and fast load times for users.&lt;/p&gt;

&lt;h3 id=&quot;javascript-interoperability&quot; class=&quot;header-with-anchor&quot;&gt;JavaScript interoperability &lt;a title=&quot;Permalink for JavaScript interoperability section&quot; href=&quot;#javascript-interoperability&quot;&gt;
            &lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt; &lt;svg width=&quot;18px&quot; height=&quot;18px&quot; viewBox=&quot;0 0 14 14&quot; role=&quot;img&quot; focusable=&quot;false&quot; aria-hidden=&quot;true&quot; xmlns=&quot;http://www.w3.org/2000/svg&quot;&gt;&lt;path d=&quot;m 11.58824,9.823529 q 0,-0.294117 -0.20589,-0.499999 L 9.85294,7.794118 q -0.20588,-0.205883 -0.5,-0.205883 -0.30882,0 -0.52941,0.235295 0.0221,0.02206 0.13971,0.136029 0.11764,0.113971 0.15808,0.158088 0.0404,0.04412 0.1103,0.139706 0.0698,0.09559 0.0956,0.1875 0.0257,0.09191 0.0257,0.202206 0,0.294117 -0.20588,0.5 -0.20588,0.205882 -0.5,0.205882 -0.1103,0 -0.20221,-0.02573 Q 8.35293,9.301471 8.25733,9.231621 8.16173,9.161771 8.11763,9.121327 8.07353,9.080887 7.95954,8.963238 7.84557,8.845591 7.82351,8.823533 7.58086,9.051474 7.58086,9.360297 q 0,0.294118 0.20588,0.5 l 1.51471,1.522059 q 0.19853,0.19853 0.5,0.19853 0.29412,0 0.5,-0.191177 l 1.08088,-1.073529 q 0.20589,-0.205883 0.20589,-0.492648 z M 6.41912,4.639706 q 0,-0.294118 -0.20588,-0.5 L 4.69853,2.617647 q -0.20588,-0.205882 -0.5,-0.205882 -0.28677,0 -0.5,0.198529 L 2.61765,3.683823 q -0.20589,0.205883 -0.20589,0.492648 0,0.294117 0.20589,0.499999 l 1.52941,1.529412 q 0.19853,0.19853 0.5,0.19853 0.30882,0 0.52941,-0.227942 Q 5.15437,6.15441 5.03676,6.040441 4.91912,5.92647 4.87868,5.882353 4.83828,5.838233 4.76838,5.742647 q -0.0698,-0.09559 -0.0956,-0.1875 -0.0257,-0.09191 -0.0257,-0.202206 0,-0.294117 0.20588,-0.5 0.20588,-0.205882 0.5,-0.205882 0.1103,0 0.20221,0.02573 0.0919,0.02573 0.1875,0.09559 0.0956,0.06985 0.1397,0.110294 0.0441,0.04044 0.15809,0.158089 Q 6.15443,5.154409 6.17649,5.176467 6.41914,4.948526 6.41914,4.639703 z M 13,9.823529 q 0,0.882353 -0.625,1.492647 l -1.08088,1.07353 Q 10.68382,13 9.80147,13 q -0.88971,0 -1.5,-0.625 L 6.78676,10.852941 Q 6.17647,10.242647 6.17647,9.360294 q 0,-0.904412 0.64706,-1.536764 L 6.17647,7.176471 Q 5.54412,7.82353 4.64706,7.82353 q -0.88235,0 -1.5,-0.617648 L 1.617647,5.676471 Q 1,5.058824 1,4.176471 1,3.294118 1.625,2.683824 L 2.70588,1.610294 Q 3.31618,1 4.19853,1 q 0.88971,0 1.5,0.625 l 1.51471,1.522059 q 0.61029,0.610294 0.61029,1.492647 0,0.904412 -0.64706,1.536764 L 7.82353,6.823529 Q 8.45588,6.17647 9.35294,6.17647 q 0.88235,0 1.5,0.617648 l 1.52941,1.529411 Q 13,8.941176 13,9.823529 z&quot;/&gt;&lt;/svg&gt;
          &lt;/a&gt;&lt;/h3&gt;

&lt;p&gt;We use &lt;a href=&quot;https://github.com/swiftwasm/JavaScriptKit&quot;&gt;JavaScriptKit&lt;/a&gt; for seamless interoperability between Swift and JavaScript. This allows us to integrate with the existing web ecosystem while keeping our core logic in Swift.&lt;/p&gt;

&lt;h3 id=&quot;platform-compatibility-considerations&quot; class=&quot;header-with-anchor&quot;&gt;Platform compatibility considerations &lt;a title=&quot;Permalink for Platform compatibility considerations section&quot; href=&quot;#platform-compatibility-considerations&quot;&gt;
            &lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt; &lt;svg width=&quot;18px&quot; height=&quot;18px&quot; viewBox=&quot;0 0 14 14&quot; role=&quot;img&quot; focusable=&quot;false&quot; aria-hidden=&quot;true&quot; xmlns=&quot;http://www.w3.org/2000/svg&quot;&gt;&lt;path d=&quot;m 11.58824,9.823529 q 0,-0.294117 -0.20589,-0.499999 L 9.85294,7.794118 q -0.20588,-0.205883 -0.5,-0.205883 -0.30882,0 -0.52941,0.235295 0.0221,0.02206 0.13971,0.136029 0.11764,0.113971 0.15808,0.158088 0.0404,0.04412 0.1103,0.139706 0.0698,0.09559 0.0956,0.1875 0.0257,0.09191 0.0257,0.202206 0,0.294117 -0.20588,0.5 -0.20588,0.205882 -0.5,0.205882 -0.1103,0 -0.20221,-0.02573 Q 8.35293,9.301471 8.25733,9.231621 8.16173,9.161771 8.11763,9.121327 8.07353,9.080887 7.95954,8.963238 7.84557,8.845591 7.82351,8.823533 7.58086,9.051474 7.58086,9.360297 q 0,0.294118 0.20588,0.5 l 1.51471,1.522059 q 0.19853,0.19853 0.5,0.19853 0.29412,0 0.5,-0.191177 l 1.08088,-1.073529 q 0.20589,-0.205883 0.20589,-0.492648 z M 6.41912,4.639706 q 0,-0.294118 -0.20588,-0.5 L 4.69853,2.617647 q -0.20588,-0.205882 -0.5,-0.205882 -0.28677,0 -0.5,0.198529 L 2.61765,3.683823 q -0.20589,0.205883 -0.20589,0.492648 0,0.294117 0.20589,0.499999 l 1.52941,1.529412 q 0.19853,0.19853 0.5,0.19853 0.30882,0 0.52941,-0.227942 Q 5.15437,6.15441 5.03676,6.040441 4.91912,5.92647 4.87868,5.882353 4.83828,5.838233 4.76838,5.742647 q -0.0698,-0.09559 -0.0956,-0.1875 -0.0257,-0.09191 -0.0257,-0.202206 0,-0.294117 0.20588,-0.5 0.20588,-0.205882 0.5,-0.205882 0.1103,0 0.20221,0.02573 0.0919,0.02573 0.1875,0.09559 0.0956,0.06985 0.1397,0.110294 0.0441,0.04044 0.15809,0.158089 Q 6.15443,5.154409 6.17649,5.176467 6.41914,4.948526 6.41914,4.639703 z M 13,9.823529 q 0,0.882353 -0.625,1.492647 l -1.08088,1.07353 Q 10.68382,13 9.80147,13 q -0.88971,0 -1.5,-0.625 L 6.78676,10.852941 Q 6.17647,10.242647 6.17647,9.360294 q 0,-0.904412 0.64706,-1.536764 L 6.17647,7.176471 Q 5.54412,7.82353 4.64706,7.82353 q -0.88235,0 -1.5,-0.617648 L 1.617647,5.676471 Q 1,5.058824 1,4.176471 1,3.294118 1.625,2.683824 L 2.70588,1.610294 Q 3.31618,1 4.19853,1 q 0.88971,0 1.5,0.625 l 1.51471,1.522059 q 0.61029,0.610294 0.61029,1.492647 0,0.904412 -0.64706,1.536764 L 7.82353,6.823529 Q 8.45588,6.17647 9.35294,6.17647 q 0.88235,0 1.5,0.617648 l 1.52941,1.529411 Q 13,8.941176 13,9.823529 z&quot;/&gt;&lt;/svg&gt;
          &lt;/a&gt;&lt;/h3&gt;

&lt;p&gt;When sharing code between iOS and WebAssembly targets, we encountered several important considerations:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Concurrency Model&lt;/strong&gt;: libdispatch APIs are unavailable on WebAssembly targets. We migrated from direct libdispatch usage to Swift Concurrency’s &lt;a href=&quot;https://docs.swift.org/swift-book/documentation/the-swift-programming-language/concurrency/&quot;&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;async&lt;/code&gt;/&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;await&lt;/code&gt; and actors&lt;/a&gt;, for better cross-platform compatibility.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Architecture Differences&lt;/strong&gt;: On wasm32, Swift’s &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Int&lt;/code&gt; has a 32-bit width. Some code assumed &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Int&lt;/code&gt; only held 64-bit values, so it had to be updated to use &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Int64&lt;/code&gt; explicitly.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Dependency Injection&lt;/strong&gt;: Network access and other I/O operations are abstracted through dependency injection, allowing us to provide platform-specific implementations while keeping the core logic shared.&lt;/p&gt;

&lt;h3 id=&quot;multithreading-with-wasi-threads&quot; class=&quot;header-with-anchor&quot;&gt;Multithreading with WASI threads &lt;a title=&quot;Permalink for Multithreading with WASI threads section&quot; href=&quot;#multithreading-with-wasi-threads&quot;&gt;
            &lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt; &lt;svg width=&quot;18px&quot; height=&quot;18px&quot; viewBox=&quot;0 0 14 14&quot; role=&quot;img&quot; focusable=&quot;false&quot; aria-hidden=&quot;true&quot; xmlns=&quot;http://www.w3.org/2000/svg&quot;&gt;&lt;path d=&quot;m 11.58824,9.823529 q 0,-0.294117 -0.20589,-0.499999 L 9.85294,7.794118 q -0.20588,-0.205883 -0.5,-0.205883 -0.30882,0 -0.52941,0.235295 0.0221,0.02206 0.13971,0.136029 0.11764,0.113971 0.15808,0.158088 0.0404,0.04412 0.1103,0.139706 0.0698,0.09559 0.0956,0.1875 0.0257,0.09191 0.0257,0.202206 0,0.294117 -0.20588,0.5 -0.20588,0.205882 -0.5,0.205882 -0.1103,0 -0.20221,-0.02573 Q 8.35293,9.301471 8.25733,9.231621 8.16173,9.161771 8.11763,9.121327 8.07353,9.080887 7.95954,8.963238 7.84557,8.845591 7.82351,8.823533 7.58086,9.051474 7.58086,9.360297 q 0,0.294118 0.20588,0.5 l 1.51471,1.522059 q 0.19853,0.19853 0.5,0.19853 0.29412,0 0.5,-0.191177 l 1.08088,-1.073529 q 0.20589,-0.205883 0.20589,-0.492648 z M 6.41912,4.639706 q 0,-0.294118 -0.20588,-0.5 L 4.69853,2.617647 q -0.20588,-0.205882 -0.5,-0.205882 -0.28677,0 -0.5,0.198529 L 2.61765,3.683823 q -0.20589,0.205883 -0.20589,0.492648 0,0.294117 0.20589,0.499999 l 1.52941,1.529412 q 0.19853,0.19853 0.5,0.19853 0.30882,0 0.52941,-0.227942 Q 5.15437,6.15441 5.03676,6.040441 4.91912,5.92647 4.87868,5.882353 4.83828,5.838233 4.76838,5.742647 q -0.0698,-0.09559 -0.0956,-0.1875 -0.0257,-0.09191 -0.0257,-0.202206 0,-0.294117 0.20588,-0.5 0.20588,-0.205882 0.5,-0.205882 0.1103,0 0.20221,0.02573 0.0919,0.02573 0.1875,0.09559 0.0956,0.06985 0.1397,0.110294 0.0441,0.04044 0.15809,0.158089 Q 6.15443,5.154409 6.17649,5.176467 6.41914,4.948526 6.41914,4.639703 z M 13,9.823529 q 0,0.882353 -0.625,1.492647 l -1.08088,1.07353 Q 10.68382,13 9.80147,13 q -0.88971,0 -1.5,-0.625 L 6.78676,10.852941 Q 6.17647,10.242647 6.17647,9.360294 q 0,-0.904412 0.64706,-1.536764 L 6.17647,7.176471 Q 5.54412,7.82353 4.64706,7.82353 q -0.88235,0 -1.5,-0.617648 L 1.617647,5.676471 Q 1,5.058824 1,4.176471 1,3.294118 1.625,2.683824 L 2.70588,1.610294 Q 3.31618,1 4.19853,1 q 0.88971,0 1.5,0.625 l 1.51471,1.522059 q 0.61029,0.610294 0.61029,1.492647 0,0.904412 -0.64706,1.536764 L 7.82353,6.823529 Q 8.45588,6.17647 9.35294,6.17647 q 0.88235,0 1.5,0.617648 l 1.52941,1.529411 Q 13,8.941176 13,9.823529 z&quot;/&gt;&lt;/svg&gt;
          &lt;/a&gt;&lt;/h3&gt;

&lt;p&gt;One of the most significant technical achievements was implementing true parallelism using &lt;a href=&quot;https://github.com/WebAssembly/wasi-threads&quot;&gt;WebAssembly System Interface (WASI) Threads&lt;/a&gt; with &lt;a href=&quot;https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API&quot;&gt;Web Workers&lt;/a&gt; and &lt;a href=&quot;https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/SharedArrayBuffer&quot;&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;SharedArrayBuffer&lt;/code&gt;&lt;/a&gt;. This allows us to:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;Run handwriting recognition in background Web Workers&lt;/li&gt;
  &lt;li&gt;Perform document indexing without blocking the main thread&lt;/li&gt;
  &lt;li&gt;Maintain smooth rendering at more than 60 FPS while processing complex operations&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Swift Concurrency’s &lt;a href=&quot;https://github.com/swiftlang/swift-evolution/blob/main/proposals/0392-custom-actor-executors.md&quot;&gt;Custom Actor Executors (SE-0392)&lt;/a&gt; were crucial for managing the web platform’s constraints. JavaScript objects are isolated to their originating thread, so we needed precise control over where our Swift actors execute. &lt;a href=&quot;https://swiftpackageindex.com/swiftwasm/javascriptkit/0.35.0/documentation/javascripteventloop/webworkerdedicatedexecutor&quot;&gt;JavaScriptKit provides several APIs&lt;/a&gt; to create a SerialExecutor for a dedicated Web Worker, enabling us to pin specific actors to specific Web Workers.&lt;/p&gt;

&lt;p&gt;This architecture ensures that computationally-intensive tasks like handwriting recognition run in the background while UI operations stay on the main thread, while still allowing access to JavaScript objects inside background threads.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Performance Impact&lt;/strong&gt;: This multithreading approach delivered a greater than 2x improvement in &lt;a href=&quot;https://web.dev/articles/inp&quot;&gt;Interaction to Next Paint (INP)&lt;/a&gt;, significantly enhancing the UI responsiveness during complex operations.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Security Considerations&lt;/strong&gt;: Modern browser security policies require &lt;a href=&quot;https://web.dev/articles/cross-origin-isolation-guide&quot;&gt;Cross-Origin Isolation to use SharedArrayBuffer&lt;/a&gt;. While this adds some complexity to the application, it’s a necessary trade-off for the performance benefits of true parallelism. For applications that can’t meet these requirements, single-threaded cooperative concurrent execution remains a viable option.&lt;/p&gt;

&lt;h2 id=&quot;development-experience&quot; class=&quot;header-with-anchor&quot;&gt;Development experience &lt;a title=&quot;Permalink for Development experience section&quot; href=&quot;#development-experience&quot;&gt;
            &lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt; &lt;svg width=&quot;18px&quot; height=&quot;18px&quot; viewBox=&quot;0 0 14 14&quot; role=&quot;img&quot; focusable=&quot;false&quot; aria-hidden=&quot;true&quot; xmlns=&quot;http://www.w3.org/2000/svg&quot;&gt;&lt;path d=&quot;m 11.58824,9.823529 q 0,-0.294117 -0.20589,-0.499999 L 9.85294,7.794118 q -0.20588,-0.205883 -0.5,-0.205883 -0.30882,0 -0.52941,0.235295 0.0221,0.02206 0.13971,0.136029 0.11764,0.113971 0.15808,0.158088 0.0404,0.04412 0.1103,0.139706 0.0698,0.09559 0.0956,0.1875 0.0257,0.09191 0.0257,0.202206 0,0.294117 -0.20588,0.5 -0.20588,0.205882 -0.5,0.205882 -0.1103,0 -0.20221,-0.02573 Q 8.35293,9.301471 8.25733,9.231621 8.16173,9.161771 8.11763,9.121327 8.07353,9.080887 7.95954,8.963238 7.84557,8.845591 7.82351,8.823533 7.58086,9.051474 7.58086,9.360297 q 0,0.294118 0.20588,0.5 l 1.51471,1.522059 q 0.19853,0.19853 0.5,0.19853 0.29412,0 0.5,-0.191177 l 1.08088,-1.073529 q 0.20589,-0.205883 0.20589,-0.492648 z M 6.41912,4.639706 q 0,-0.294118 -0.20588,-0.5 L 4.69853,2.617647 q -0.20588,-0.205882 -0.5,-0.205882 -0.28677,0 -0.5,0.198529 L 2.61765,3.683823 q -0.20589,0.205883 -0.20589,0.492648 0,0.294117 0.20589,0.499999 l 1.52941,1.529412 q 0.19853,0.19853 0.5,0.19853 0.30882,0 0.52941,-0.227942 Q 5.15437,6.15441 5.03676,6.040441 4.91912,5.92647 4.87868,5.882353 4.83828,5.838233 4.76838,5.742647 q -0.0698,-0.09559 -0.0956,-0.1875 -0.0257,-0.09191 -0.0257,-0.202206 0,-0.294117 0.20588,-0.5 0.20588,-0.205882 0.5,-0.205882 0.1103,0 0.20221,0.02573 0.0919,0.02573 0.1875,0.09559 0.0956,0.06985 0.1397,0.110294 0.0441,0.04044 0.15809,0.158089 Q 6.15443,5.154409 6.17649,5.176467 6.41914,4.948526 6.41914,4.639703 z M 13,9.823529 q 0,0.882353 -0.625,1.492647 l -1.08088,1.07353 Q 10.68382,13 9.80147,13 q -0.88971,0 -1.5,-0.625 L 6.78676,10.852941 Q 6.17647,10.242647 6.17647,9.360294 q 0,-0.904412 0.64706,-1.536764 L 6.17647,7.176471 Q 5.54412,7.82353 4.64706,7.82353 q -0.88235,0 -1.5,-0.617648 L 1.617647,5.676471 Q 1,5.058824 1,4.176471 1,3.294118 1.625,2.683824 L 2.70588,1.610294 Q 3.31618,1 4.19853,1 q 0.88971,0 1.5,0.625 l 1.51471,1.522059 q 0.61029,0.610294 0.61029,1.492647 0,0.904412 -0.64706,1.536764 L 7.82353,6.823529 Q 8.45588,6.17647 9.35294,6.17647 q 0.88235,0 1.5,0.617648 l 1.52941,1.529411 Q 13,8.941176 13,9.823529 z&quot;/&gt;&lt;/svg&gt;
          &lt;/a&gt;&lt;/h2&gt;

&lt;p&gt;One of the most significant aspects of our Swift on WebAssembly experience was the development workflow. The tooling ecosystem is mature and powerful, providing a solid development experience.&lt;/p&gt;

&lt;h3 id=&quot;ide-support&quot; class=&quot;header-with-anchor&quot;&gt;IDE support &lt;a title=&quot;Permalink for IDE support section&quot; href=&quot;#ide-support&quot;&gt;
            &lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt; &lt;svg width=&quot;18px&quot; height=&quot;18px&quot; viewBox=&quot;0 0 14 14&quot; role=&quot;img&quot; focusable=&quot;false&quot; aria-hidden=&quot;true&quot; xmlns=&quot;http://www.w3.org/2000/svg&quot;&gt;&lt;path d=&quot;m 11.58824,9.823529 q 0,-0.294117 -0.20589,-0.499999 L 9.85294,7.794118 q -0.20588,-0.205883 -0.5,-0.205883 -0.30882,0 -0.52941,0.235295 0.0221,0.02206 0.13971,0.136029 0.11764,0.113971 0.15808,0.158088 0.0404,0.04412 0.1103,0.139706 0.0698,0.09559 0.0956,0.1875 0.0257,0.09191 0.0257,0.202206 0,0.294117 -0.20588,0.5 -0.20588,0.205882 -0.5,0.205882 -0.1103,0 -0.20221,-0.02573 Q 8.35293,9.301471 8.25733,9.231621 8.16173,9.161771 8.11763,9.121327 8.07353,9.080887 7.95954,8.963238 7.84557,8.845591 7.82351,8.823533 7.58086,9.051474 7.58086,9.360297 q 0,0.294118 0.20588,0.5 l 1.51471,1.522059 q 0.19853,0.19853 0.5,0.19853 0.29412,0 0.5,-0.191177 l 1.08088,-1.073529 q 0.20589,-0.205883 0.20589,-0.492648 z M 6.41912,4.639706 q 0,-0.294118 -0.20588,-0.5 L 4.69853,2.617647 q -0.20588,-0.205882 -0.5,-0.205882 -0.28677,0 -0.5,0.198529 L 2.61765,3.683823 q -0.20589,0.205883 -0.20589,0.492648 0,0.294117 0.20589,0.499999 l 1.52941,1.529412 q 0.19853,0.19853 0.5,0.19853 0.30882,0 0.52941,-0.227942 Q 5.15437,6.15441 5.03676,6.040441 4.91912,5.92647 4.87868,5.882353 4.83828,5.838233 4.76838,5.742647 q -0.0698,-0.09559 -0.0956,-0.1875 -0.0257,-0.09191 -0.0257,-0.202206 0,-0.294117 0.20588,-0.5 0.20588,-0.205882 0.5,-0.205882 0.1103,0 0.20221,0.02573 0.0919,0.02573 0.1875,0.09559 0.0956,0.06985 0.1397,0.110294 0.0441,0.04044 0.15809,0.158089 Q 6.15443,5.154409 6.17649,5.176467 6.41914,4.948526 6.41914,4.639703 z M 13,9.823529 q 0,0.882353 -0.625,1.492647 l -1.08088,1.07353 Q 10.68382,13 9.80147,13 q -0.88971,0 -1.5,-0.625 L 6.78676,10.852941 Q 6.17647,10.242647 6.17647,9.360294 q 0,-0.904412 0.64706,-1.536764 L 6.17647,7.176471 Q 5.54412,7.82353 4.64706,7.82353 q -0.88235,0 -1.5,-0.617648 L 1.617647,5.676471 Q 1,5.058824 1,4.176471 1,3.294118 1.625,2.683824 L 2.70588,1.610294 Q 3.31618,1 4.19853,1 q 0.88971,0 1.5,0.625 l 1.51471,1.522059 q 0.61029,0.610294 0.61029,1.492647 0,0.904412 -0.64706,1.536764 L 7.82353,6.823529 Q 8.45588,6.17647 9.35294,6.17647 q 0.88235,0 1.5,0.617648 l 1.52941,1.529411 Q 13,8.941176 13,9.823529 z&quot;/&gt;&lt;/svg&gt;
          &lt;/a&gt;&lt;/h3&gt;

&lt;p&gt;We can develop using either Xcode or VS Code with SourceKit-LSP, providing full language server support including autocomplete, error checking, and refactoring capabilities.&lt;/p&gt;

&lt;p&gt;Xcode doesn’t currently have WebAssembly platform support, so code completion and other features are limited for WebAssembly-specific APIs. SourceKit-LSP, however, has Swift SDK support, so by properly configuring &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;.sourcekit-lsp/config.json&lt;/code&gt;, you can get code completion for WebAssembly targets as well.&lt;/p&gt;

&lt;h3 id=&quot;debugging-and-development-tools&quot; class=&quot;header-with-anchor&quot;&gt;Debugging and development tools &lt;a title=&quot;Permalink for Debugging and development tools section&quot; href=&quot;#debugging-and-development-tools&quot;&gt;
            &lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt; &lt;svg width=&quot;18px&quot; height=&quot;18px&quot; viewBox=&quot;0 0 14 14&quot; role=&quot;img&quot; focusable=&quot;false&quot; aria-hidden=&quot;true&quot; xmlns=&quot;http://www.w3.org/2000/svg&quot;&gt;&lt;path d=&quot;m 11.58824,9.823529 q 0,-0.294117 -0.20589,-0.499999 L 9.85294,7.794118 q -0.20588,-0.205883 -0.5,-0.205883 -0.30882,0 -0.52941,0.235295 0.0221,0.02206 0.13971,0.136029 0.11764,0.113971 0.15808,0.158088 0.0404,0.04412 0.1103,0.139706 0.0698,0.09559 0.0956,0.1875 0.0257,0.09191 0.0257,0.202206 0,0.294117 -0.20588,0.5 -0.20588,0.205882 -0.5,0.205882 -0.1103,0 -0.20221,-0.02573 Q 8.35293,9.301471 8.25733,9.231621 8.16173,9.161771 8.11763,9.121327 8.07353,9.080887 7.95954,8.963238 7.84557,8.845591 7.82351,8.823533 7.58086,9.051474 7.58086,9.360297 q 0,0.294118 0.20588,0.5 l 1.51471,1.522059 q 0.19853,0.19853 0.5,0.19853 0.29412,0 0.5,-0.191177 l 1.08088,-1.073529 q 0.20589,-0.205883 0.20589,-0.492648 z M 6.41912,4.639706 q 0,-0.294118 -0.20588,-0.5 L 4.69853,2.617647 q -0.20588,-0.205882 -0.5,-0.205882 -0.28677,0 -0.5,0.198529 L 2.61765,3.683823 q -0.20589,0.205883 -0.20589,0.492648 0,0.294117 0.20589,0.499999 l 1.52941,1.529412 q 0.19853,0.19853 0.5,0.19853 0.30882,0 0.52941,-0.227942 Q 5.15437,6.15441 5.03676,6.040441 4.91912,5.92647 4.87868,5.882353 4.83828,5.838233 4.76838,5.742647 q -0.0698,-0.09559 -0.0956,-0.1875 -0.0257,-0.09191 -0.0257,-0.202206 0,-0.294117 0.20588,-0.5 0.20588,-0.205882 0.5,-0.205882 0.1103,0 0.20221,0.02573 0.0919,0.02573 0.1875,0.09559 0.0956,0.06985 0.1397,0.110294 0.0441,0.04044 0.15809,0.158089 Q 6.15443,5.154409 6.17649,5.176467 6.41914,4.948526 6.41914,4.639703 z M 13,9.823529 q 0,0.882353 -0.625,1.492647 l -1.08088,1.07353 Q 10.68382,13 9.80147,13 q -0.88971,0 -1.5,-0.625 L 6.78676,10.852941 Q 6.17647,10.242647 6.17647,9.360294 q 0,-0.904412 0.64706,-1.536764 L 6.17647,7.176471 Q 5.54412,7.82353 4.64706,7.82353 q -0.88235,0 -1.5,-0.617648 L 1.617647,5.676471 Q 1,5.058824 1,4.176471 1,3.294118 1.625,2.683824 L 2.70588,1.610294 Q 3.31618,1 4.19853,1 q 0.88971,0 1.5,0.625 l 1.51471,1.522059 q 0.61029,0.610294 0.61029,1.492647 0,0.904412 -0.64706,1.536764 L 7.82353,6.823529 Q 8.45588,6.17647 9.35294,6.17647 q 0.88235,0 1.5,0.617648 l 1.52941,1.529411 Q 13,8.941176 13,9.823529 z&quot;/&gt;&lt;/svg&gt;
          &lt;/a&gt;&lt;/h3&gt;

&lt;p&gt;You can debug Swift code directly in Chrome DevTools: set breakpoints, inspect variables, and step through your Swift code as naturally as JavaScript. We developed a Chrome DevTools extension library that enables Swift-specific variable reflection and source-level debugging, building upon the existing &lt;a href=&quot;https://developer.chrome.com/docs/devtools/wasm&quot;&gt;WebAssembly debugging capabilities&lt;/a&gt;. For more details on the enhanced DWARF extension for Swift, see the &lt;a href=&quot;https://swiftpackageindex.com/swiftwasm/javascriptkit/0.53.0/documentation/javascriptkit/debugging#Enhanced-DWARF-Extension-for-Swift&quot;&gt;Swift on WebAssembly debugging guide&lt;/a&gt;.&lt;/p&gt;

&lt;div style=&quot;margin: 2em auto;&quot;&gt;
  &lt;img alt=&quot;Chrome DevTools debugging Swift code compiled to WebAssembly, showing breakpoints, variable inspection, and call stack.&quot; src=&quot;/assets/images/bringing-goodnotes-to-web-with-swift/chrome-devtools-swift.png&quot; width=&quot;840&quot; height=&quot;525&quot; style=&quot;max-width: 100%; width: 100%; height: auto; margin: auto; display: block;&quot; /&gt;
  &lt;div style=&quot;text-align: center; font-size: smaller; margin-top: 1em;&quot;&gt;Debugging Swift code in Chrome DevTools with full source code visibility and variable inspection.&lt;/div&gt;
&lt;/div&gt;

&lt;h3 id=&quot;performance-profiling&quot; class=&quot;header-with-anchor&quot;&gt;Performance profiling &lt;a title=&quot;Permalink for Performance profiling section&quot; href=&quot;#performance-profiling&quot;&gt;
            &lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt; &lt;svg width=&quot;18px&quot; height=&quot;18px&quot; viewBox=&quot;0 0 14 14&quot; role=&quot;img&quot; focusable=&quot;false&quot; aria-hidden=&quot;true&quot; xmlns=&quot;http://www.w3.org/2000/svg&quot;&gt;&lt;path d=&quot;m 11.58824,9.823529 q 0,-0.294117 -0.20589,-0.499999 L 9.85294,7.794118 q -0.20588,-0.205883 -0.5,-0.205883 -0.30882,0 -0.52941,0.235295 0.0221,0.02206 0.13971,0.136029 0.11764,0.113971 0.15808,0.158088 0.0404,0.04412 0.1103,0.139706 0.0698,0.09559 0.0956,0.1875 0.0257,0.09191 0.0257,0.202206 0,0.294117 -0.20588,0.5 -0.20588,0.205882 -0.5,0.205882 -0.1103,0 -0.20221,-0.02573 Q 8.35293,9.301471 8.25733,9.231621 8.16173,9.161771 8.11763,9.121327 8.07353,9.080887 7.95954,8.963238 7.84557,8.845591 7.82351,8.823533 7.58086,9.051474 7.58086,9.360297 q 0,0.294118 0.20588,0.5 l 1.51471,1.522059 q 0.19853,0.19853 0.5,0.19853 0.29412,0 0.5,-0.191177 l 1.08088,-1.073529 q 0.20589,-0.205883 0.20589,-0.492648 z M 6.41912,4.639706 q 0,-0.294118 -0.20588,-0.5 L 4.69853,2.617647 q -0.20588,-0.205882 -0.5,-0.205882 -0.28677,0 -0.5,0.198529 L 2.61765,3.683823 q -0.20589,0.205883 -0.20589,0.492648 0,0.294117 0.20589,0.499999 l 1.52941,1.529412 q 0.19853,0.19853 0.5,0.19853 0.30882,0 0.52941,-0.227942 Q 5.15437,6.15441 5.03676,6.040441 4.91912,5.92647 4.87868,5.882353 4.83828,5.838233 4.76838,5.742647 q -0.0698,-0.09559 -0.0956,-0.1875 -0.0257,-0.09191 -0.0257,-0.202206 0,-0.294117 0.20588,-0.5 0.20588,-0.205882 0.5,-0.205882 0.1103,0 0.20221,0.02573 0.0919,0.02573 0.1875,0.09559 0.0956,0.06985 0.1397,0.110294 0.0441,0.04044 0.15809,0.158089 Q 6.15443,5.154409 6.17649,5.176467 6.41914,4.948526 6.41914,4.639703 z M 13,9.823529 q 0,0.882353 -0.625,1.492647 l -1.08088,1.07353 Q 10.68382,13 9.80147,13 q -0.88971,0 -1.5,-0.625 L 6.78676,10.852941 Q 6.17647,10.242647 6.17647,9.360294 q 0,-0.904412 0.64706,-1.536764 L 6.17647,7.176471 Q 5.54412,7.82353 4.64706,7.82353 q -0.88235,0 -1.5,-0.617648 L 1.617647,5.676471 Q 1,5.058824 1,4.176471 1,3.294118 1.625,2.683824 L 2.70588,1.610294 Q 3.31618,1 4.19853,1 q 0.88971,0 1.5,0.625 l 1.51471,1.522059 q 0.61029,0.610294 0.61029,1.492647 0,0.904412 -0.64706,1.536764 L 7.82353,6.823529 Q 8.45588,6.17647 9.35294,6.17647 q 0.88235,0 1.5,0.617648 l 1.52941,1.529411 Q 13,8.941176 13,9.823529 z&quot;/&gt;&lt;/svg&gt;
          &lt;/a&gt;&lt;/h3&gt;

&lt;p&gt;The existing web ecosystem provides powerful performance profiling tools. Chrome’s Performance tab shows exactly where time is spent, down to individual Swift functions, and the Memory tab gives us good insight into memory usage patterns. For most performance optimization tasks, these standard tools are quite effective.&lt;/p&gt;

&lt;p&gt;For more advanced cases requiring specialized memory profiling capabilities and detailed heap analysis, the growing WebAssembly ecosystem provided the foundation for building custom tools. We developed &lt;a href=&quot;https://github.com/kateinoigakukun/wasm-memprof&quot;&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;wasm-memprof&lt;/code&gt;&lt;/a&gt; for detailed heap profiling when optimizing memory usage. This tool provides insights into memory allocation patterns that aren’t easily visible through standard web profiling tools.&lt;/p&gt;

&lt;div style=&quot;margin: 2em auto;&quot;&gt;
  &lt;img alt=&quot;wasm-memprof performance profiling tool showing flame graph and memory allocation analysis for WebAssembly applications.&quot; src=&quot;/assets/images/bringing-goodnotes-to-web-with-swift/wasmmemprof.png&quot; width=&quot;840&quot; height=&quot;525&quot; style=&quot;max-width: 100%; width: 100%; height: auto; margin: auto; display: block;&quot; /&gt;
  &lt;div style=&quot;text-align: center; font-size: smaller; margin-top: 1em;&quot;&gt;Performance profiling with wasm-memprof showing memory allocation patterns and optimization opportunities.&lt;/div&gt;
&lt;/div&gt;

&lt;h2 id=&quot;contributing-back-to-the-community&quot; class=&quot;header-with-anchor&quot;&gt;Contributing back to the community &lt;a title=&quot;Permalink for Contributing back to the community section&quot; href=&quot;#contributing-back-to-the-community&quot;&gt;
            &lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt; &lt;svg width=&quot;18px&quot; height=&quot;18px&quot; viewBox=&quot;0 0 14 14&quot; role=&quot;img&quot; focusable=&quot;false&quot; aria-hidden=&quot;true&quot; xmlns=&quot;http://www.w3.org/2000/svg&quot;&gt;&lt;path d=&quot;m 11.58824,9.823529 q 0,-0.294117 -0.20589,-0.499999 L 9.85294,7.794118 q -0.20588,-0.205883 -0.5,-0.205883 -0.30882,0 -0.52941,0.235295 0.0221,0.02206 0.13971,0.136029 0.11764,0.113971 0.15808,0.158088 0.0404,0.04412 0.1103,0.139706 0.0698,0.09559 0.0956,0.1875 0.0257,0.09191 0.0257,0.202206 0,0.294117 -0.20588,0.5 -0.20588,0.205882 -0.5,0.205882 -0.1103,0 -0.20221,-0.02573 Q 8.35293,9.301471 8.25733,9.231621 8.16173,9.161771 8.11763,9.121327 8.07353,9.080887 7.95954,8.963238 7.84557,8.845591 7.82351,8.823533 7.58086,9.051474 7.58086,9.360297 q 0,0.294118 0.20588,0.5 l 1.51471,1.522059 q 0.19853,0.19853 0.5,0.19853 0.29412,0 0.5,-0.191177 l 1.08088,-1.073529 q 0.20589,-0.205883 0.20589,-0.492648 z M 6.41912,4.639706 q 0,-0.294118 -0.20588,-0.5 L 4.69853,2.617647 q -0.20588,-0.205882 -0.5,-0.205882 -0.28677,0 -0.5,0.198529 L 2.61765,3.683823 q -0.20589,0.205883 -0.20589,0.492648 0,0.294117 0.20589,0.499999 l 1.52941,1.529412 q 0.19853,0.19853 0.5,0.19853 0.30882,0 0.52941,-0.227942 Q 5.15437,6.15441 5.03676,6.040441 4.91912,5.92647 4.87868,5.882353 4.83828,5.838233 4.76838,5.742647 q -0.0698,-0.09559 -0.0956,-0.1875 -0.0257,-0.09191 -0.0257,-0.202206 0,-0.294117 0.20588,-0.5 0.20588,-0.205882 0.5,-0.205882 0.1103,0 0.20221,0.02573 0.0919,0.02573 0.1875,0.09559 0.0956,0.06985 0.1397,0.110294 0.0441,0.04044 0.15809,0.158089 Q 6.15443,5.154409 6.17649,5.176467 6.41914,4.948526 6.41914,4.639703 z M 13,9.823529 q 0,0.882353 -0.625,1.492647 l -1.08088,1.07353 Q 10.68382,13 9.80147,13 q -0.88971,0 -1.5,-0.625 L 6.78676,10.852941 Q 6.17647,10.242647 6.17647,9.360294 q 0,-0.904412 0.64706,-1.536764 L 6.17647,7.176471 Q 5.54412,7.82353 4.64706,7.82353 q -0.88235,0 -1.5,-0.617648 L 1.617647,5.676471 Q 1,5.058824 1,4.176471 1,3.294118 1.625,2.683824 L 2.70588,1.610294 Q 3.31618,1 4.19853,1 q 0.88971,0 1.5,0.625 l 1.51471,1.522059 q 0.61029,0.610294 0.61029,1.492647 0,0.904412 -0.64706,1.536764 L 7.82353,6.823529 Q 8.45588,6.17647 9.35294,6.17647 q 0.88235,0 1.5,0.617648 l 1.52941,1.529411 Q 13,8.941176 13,9.823529 z&quot;/&gt;&lt;/svg&gt;
          &lt;/a&gt;&lt;/h2&gt;

&lt;p&gt;As part of our journey, we’ve been able to contribute back to the Swift community in meaningful ways. All WebAssembly-related changes have been upstreamed, and &lt;strong&gt;the WebAssembly platform has been supported since Swift 6.2&lt;/strong&gt;! This means that other teams can now benefit from the same tooling and language features that made our project successful.&lt;/p&gt;

&lt;h2 id=&quot;lessons-learned&quot; class=&quot;header-with-anchor&quot;&gt;Lessons learned &lt;a title=&quot;Permalink for Lessons learned section&quot; href=&quot;#lessons-learned&quot;&gt;
            &lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt; &lt;svg width=&quot;18px&quot; height=&quot;18px&quot; viewBox=&quot;0 0 14 14&quot; role=&quot;img&quot; focusable=&quot;false&quot; aria-hidden=&quot;true&quot; xmlns=&quot;http://www.w3.org/2000/svg&quot;&gt;&lt;path d=&quot;m 11.58824,9.823529 q 0,-0.294117 -0.20589,-0.499999 L 9.85294,7.794118 q -0.20588,-0.205883 -0.5,-0.205883 -0.30882,0 -0.52941,0.235295 0.0221,0.02206 0.13971,0.136029 0.11764,0.113971 0.15808,0.158088 0.0404,0.04412 0.1103,0.139706 0.0698,0.09559 0.0956,0.1875 0.0257,0.09191 0.0257,0.202206 0,0.294117 -0.20588,0.5 -0.20588,0.205882 -0.5,0.205882 -0.1103,0 -0.20221,-0.02573 Q 8.35293,9.301471 8.25733,9.231621 8.16173,9.161771 8.11763,9.121327 8.07353,9.080887 7.95954,8.963238 7.84557,8.845591 7.82351,8.823533 7.58086,9.051474 7.58086,9.360297 q 0,0.294118 0.20588,0.5 l 1.51471,1.522059 q 0.19853,0.19853 0.5,0.19853 0.29412,0 0.5,-0.191177 l 1.08088,-1.073529 q 0.20589,-0.205883 0.20589,-0.492648 z M 6.41912,4.639706 q 0,-0.294118 -0.20588,-0.5 L 4.69853,2.617647 q -0.20588,-0.205882 -0.5,-0.205882 -0.28677,0 -0.5,0.198529 L 2.61765,3.683823 q -0.20589,0.205883 -0.20589,0.492648 0,0.294117 0.20589,0.499999 l 1.52941,1.529412 q 0.19853,0.19853 0.5,0.19853 0.30882,0 0.52941,-0.227942 Q 5.15437,6.15441 5.03676,6.040441 4.91912,5.92647 4.87868,5.882353 4.83828,5.838233 4.76838,5.742647 q -0.0698,-0.09559 -0.0956,-0.1875 -0.0257,-0.09191 -0.0257,-0.202206 0,-0.294117 0.20588,-0.5 0.20588,-0.205882 0.5,-0.205882 0.1103,0 0.20221,0.02573 0.0919,0.02573 0.1875,0.09559 0.0956,0.06985 0.1397,0.110294 0.0441,0.04044 0.15809,0.158089 Q 6.15443,5.154409 6.17649,5.176467 6.41914,4.948526 6.41914,4.639703 z M 13,9.823529 q 0,0.882353 -0.625,1.492647 l -1.08088,1.07353 Q 10.68382,13 9.80147,13 q -0.88971,0 -1.5,-0.625 L 6.78676,10.852941 Q 6.17647,10.242647 6.17647,9.360294 q 0,-0.904412 0.64706,-1.536764 L 6.17647,7.176471 Q 5.54412,7.82353 4.64706,7.82353 q -0.88235,0 -1.5,-0.617648 L 1.617647,5.676471 Q 1,5.058824 1,4.176471 1,3.294118 1.625,2.683824 L 2.70588,1.610294 Q 3.31618,1 4.19853,1 q 0.88971,0 1.5,0.625 l 1.51471,1.522059 q 0.61029,0.610294 0.61029,1.492647 0,0.904412 -0.64706,1.536764 L 7.82353,6.823529 Q 8.45588,6.17647 9.35294,6.17647 q 0.88235,0 1.5,0.617648 l 1.52941,1.529411 Q 13,8.941176 13,9.823529 z&quot;/&gt;&lt;/svg&gt;
          &lt;/a&gt;&lt;/h2&gt;

&lt;p&gt;Our experience has shown that Swift on WebAssembly is production-ready for complex applications. The language’s safety features, performance characteristics, and modern concurrency model translate well to the web platform.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;For teams considering this path, here are our key recommendations:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;Start with a performance-critical component to validate the approach.&lt;/li&gt;
  &lt;li&gt;Invest in proper platform abstraction layers early.&lt;/li&gt;
  &lt;li&gt;Leverage Swift Concurrency for cross-platform compatibility.&lt;/li&gt;
  &lt;li&gt;Plan for the security requirements of SharedArrayBuffer if multithreading is needed.&lt;/li&gt;
  &lt;li&gt;Consider gradual adoption rather than complete rewrites for existing projects.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Consider using Swift for your web projects. The growing WebAssembly ecosystem and improved tooling support make this an increasingly viable option for teams looking to share code across platforms.&lt;/p&gt;

&lt;h2 id=&quot;get-involved-with-swift-on-webassembly&quot; class=&quot;header-with-anchor&quot;&gt;Get involved with Swift on WebAssembly &lt;a title=&quot;Permalink for Get involved with Swift on WebAssembly section&quot; href=&quot;#get-involved-with-swift-on-webassembly&quot;&gt;
            &lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt; &lt;svg width=&quot;18px&quot; height=&quot;18px&quot; viewBox=&quot;0 0 14 14&quot; role=&quot;img&quot; focusable=&quot;false&quot; aria-hidden=&quot;true&quot; xmlns=&quot;http://www.w3.org/2000/svg&quot;&gt;&lt;path d=&quot;m 11.58824,9.823529 q 0,-0.294117 -0.20589,-0.499999 L 9.85294,7.794118 q -0.20588,-0.205883 -0.5,-0.205883 -0.30882,0 -0.52941,0.235295 0.0221,0.02206 0.13971,0.136029 0.11764,0.113971 0.15808,0.158088 0.0404,0.04412 0.1103,0.139706 0.0698,0.09559 0.0956,0.1875 0.0257,0.09191 0.0257,0.202206 0,0.294117 -0.20588,0.5 -0.20588,0.205882 -0.5,0.205882 -0.1103,0 -0.20221,-0.02573 Q 8.35293,9.301471 8.25733,9.231621 8.16173,9.161771 8.11763,9.121327 8.07353,9.080887 7.95954,8.963238 7.84557,8.845591 7.82351,8.823533 7.58086,9.051474 7.58086,9.360297 q 0,0.294118 0.20588,0.5 l 1.51471,1.522059 q 0.19853,0.19853 0.5,0.19853 0.29412,0 0.5,-0.191177 l 1.08088,-1.073529 q 0.20589,-0.205883 0.20589,-0.492648 z M 6.41912,4.639706 q 0,-0.294118 -0.20588,-0.5 L 4.69853,2.617647 q -0.20588,-0.205882 -0.5,-0.205882 -0.28677,0 -0.5,0.198529 L 2.61765,3.683823 q -0.20589,0.205883 -0.20589,0.492648 0,0.294117 0.20589,0.499999 l 1.52941,1.529412 q 0.19853,0.19853 0.5,0.19853 0.30882,0 0.52941,-0.227942 Q 5.15437,6.15441 5.03676,6.040441 4.91912,5.92647 4.87868,5.882353 4.83828,5.838233 4.76838,5.742647 q -0.0698,-0.09559 -0.0956,-0.1875 -0.0257,-0.09191 -0.0257,-0.202206 0,-0.294117 0.20588,-0.5 0.20588,-0.205882 0.5,-0.205882 0.1103,0 0.20221,0.02573 0.0919,0.02573 0.1875,0.09559 0.0956,0.06985 0.1397,0.110294 0.0441,0.04044 0.15809,0.158089 Q 6.15443,5.154409 6.17649,5.176467 6.41914,4.948526 6.41914,4.639703 z M 13,9.823529 q 0,0.882353 -0.625,1.492647 l -1.08088,1.07353 Q 10.68382,13 9.80147,13 q -0.88971,0 -1.5,-0.625 L 6.78676,10.852941 Q 6.17647,10.242647 6.17647,9.360294 q 0,-0.904412 0.64706,-1.536764 L 6.17647,7.176471 Q 5.54412,7.82353 4.64706,7.82353 q -0.88235,0 -1.5,-0.617648 L 1.617647,5.676471 Q 1,5.058824 1,4.176471 1,3.294118 1.625,2.683824 L 2.70588,1.610294 Q 3.31618,1 4.19853,1 q 0.88971,0 1.5,0.625 l 1.51471,1.522059 q 0.61029,0.610294 0.61029,1.492647 0,0.904412 -0.64706,1.536764 L 7.82353,6.823529 Q 8.45588,6.17647 9.35294,6.17647 q 0.88235,0 1.5,0.617648 l 1.52941,1.529411 Q 13,8.941176 13,9.823529 z&quot;/&gt;&lt;/svg&gt;
          &lt;/a&gt;&lt;/h2&gt;

&lt;p&gt;Swift has fulfilled its promise as a powerful, expressive language that works everywhere. From mobile devices to servers to web browsers, Swift code can run efficiently while maintaining the safety and performance characteristics that developers appreciate.&lt;/p&gt;

&lt;p&gt;The Swift on WebAssembly ecosystem is more accessible than ever. Here’s how you can get involved:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;For Developers:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;Try out the &lt;a href=&quot;https://www.swift.org/documentation/articles/wasm-getting-started.html&quot;&gt;Swift on WebAssembly getting started guide&lt;/a&gt; and build your first web application.&lt;/li&gt;
  &lt;li&gt;Explore the &lt;a href=&quot;https://swiftpackageindex.com/swiftwasm/javascriptkit/tutorials/javascriptkit/hello-world&quot;&gt;JavaScriptKit Hello World tutorial&lt;/a&gt; for hands-on learning.&lt;/li&gt;
  &lt;li&gt;Use the &lt;a href=&quot;https://book.swiftwasm.org/getting-started/debugging.html&quot;&gt;WebAssembly debugging guide&lt;/a&gt; to set up your development environment.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;For SwiftWasm Contributors:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;Participate in discussions with the &lt;a href=&quot;https://forums.swift.org/tag/webassembly&quot;&gt;#webassembly tag on the Swift forums&lt;/a&gt;.&lt;/li&gt;
  &lt;li&gt;Open &lt;a href=&quot;https://github.com/swiftwasm/swift&quot;&gt;issues and contribute&lt;/a&gt; to improve the toolchain.&lt;/li&gt;
  &lt;li&gt;Share your experiences and help build the community.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;With Swift’s official WebAssembly support, we’ve entered a new era of cross-platform development. The same language that powers iOS applications can now create web experiences that are fast, safe, and maintainable.&lt;/p&gt;

&lt;p&gt;Swift’s future is increasingly cross-platform, and we’re excited to see what the community builds next.&lt;/p&gt;
</content>
  </entry>
  
  <entry>
    <title>What's new in Swift: April 2026 Edition</title>
    
      
        
        <author>
        
          <name>Adam Fowler</name>
        
        </author>
      
        
        <author>
        
          <name>Dave Lester</name>
        
        </author>
      
    
    <link href="https://swift.org/blog/whats-new-in-swift-april-2026/"/>
    <updated>2026-05-01T06:30:00-04:00</updated>
    <id>https://swift.org/blog/whats-new-in-swift-april-2026/</id>
    <content type="html">&lt;p&gt;Welcome to “What’s new in Swift,” a curated digest of releases, videos, and discussions in the Swift project and community.&lt;/p&gt;

&lt;p&gt;The 1.0 release of valkey-swift was recently &lt;a href=&quot;https://valkey.io/blog/valkey-swift-1.0/&quot;&gt;announced on the Valkey blog&lt;/a&gt;. We’ve invited one of the authors to be this month’s guest contributor:&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;Hi, I’m Adam Fowler, an open source developer working in the Swift on server ecosystem. I am excited to announce the 1.0 release of &lt;a href=&quot;https://github.com/valkey-io/valkey-swift&quot;&gt;valkey-swift&lt;/a&gt; - a production-grade Swift client for &lt;a href=&quot;https://valkey.io&quot;&gt;Valkey&lt;/a&gt;.&lt;/p&gt;

  &lt;p&gt;Valkey is a high-performance datastore commonly used as a caching layer or message broker in server applications. It is an open source fork of Redis.&lt;/p&gt;

  &lt;p&gt;Valkey-swift is a client library targeted at Valkey servers but is equally capable of working with Redis. It is built from the ground up with Swift 6 and structured concurrency. Every Valkey command returns typed responses checked at compile time, and strict concurrency checking is enabled throughout so that data races are caught by the compiler, not in production. Connections and subscriptions are all scoped through structured concurrency, so resources clean up automatically.&lt;/p&gt;

  &lt;p&gt;The client covers every standard Valkey command, auto-generated from Valkey’s own command specifications to stay in sync as the server evolves.&lt;/p&gt;

  &lt;p&gt;Previously, the de facto client library for Redis was RediStack, which was built on top of pre-concurrency concepts. Retrofitting structured concurrency would have been awkward and some of the new features in valkey-swift infeasible. Around the same time Redis changed its licensing structure and the open source fork Valkey was created. So it felt like a good time to make a clean break and build a new library.&lt;/p&gt;

  &lt;p&gt;If you’re building server-side Swift and need a fast key-value store, add valkey-swift via Swift Package Manager, and you’re ready to go. If you are using RediStack to connect with a Redis server, we have a &lt;a href=&quot;https://swiftpackageindex.com/valkey-io/valkey-swift/1.3.0/documentation/valkey/migrating-from-redistack&quot;&gt;guide&lt;/a&gt; to help you migrate to valkey-swift. Complete &lt;a href=&quot;https://swiftpackageindex.com/valkey-io/valkey-swift/documentation/valkey&quot;&gt;documentation is available&lt;/a&gt;, and contributions are welcome on &lt;a href=&quot;https://github.com/valkey-io/valkey-swift&quot;&gt;GitHub&lt;/a&gt;.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Now on to other news about Swift:&lt;/p&gt;

&lt;h2 id=&quot;videos-to-watch&quot; class=&quot;header-with-anchor&quot;&gt;Videos to watch &lt;a title=&quot;Permalink for Videos to watch section&quot; href=&quot;#videos-to-watch&quot;&gt;
            &lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt; &lt;svg width=&quot;18px&quot; height=&quot;18px&quot; viewBox=&quot;0 0 14 14&quot; role=&quot;img&quot; focusable=&quot;false&quot; aria-hidden=&quot;true&quot; xmlns=&quot;http://www.w3.org/2000/svg&quot;&gt;&lt;path d=&quot;m 11.58824,9.823529 q 0,-0.294117 -0.20589,-0.499999 L 9.85294,7.794118 q -0.20588,-0.205883 -0.5,-0.205883 -0.30882,0 -0.52941,0.235295 0.0221,0.02206 0.13971,0.136029 0.11764,0.113971 0.15808,0.158088 0.0404,0.04412 0.1103,0.139706 0.0698,0.09559 0.0956,0.1875 0.0257,0.09191 0.0257,0.202206 0,0.294117 -0.20588,0.5 -0.20588,0.205882 -0.5,0.205882 -0.1103,0 -0.20221,-0.02573 Q 8.35293,9.301471 8.25733,9.231621 8.16173,9.161771 8.11763,9.121327 8.07353,9.080887 7.95954,8.963238 7.84557,8.845591 7.82351,8.823533 7.58086,9.051474 7.58086,9.360297 q 0,0.294118 0.20588,0.5 l 1.51471,1.522059 q 0.19853,0.19853 0.5,0.19853 0.29412,0 0.5,-0.191177 l 1.08088,-1.073529 q 0.20589,-0.205883 0.20589,-0.492648 z M 6.41912,4.639706 q 0,-0.294118 -0.20588,-0.5 L 4.69853,2.617647 q -0.20588,-0.205882 -0.5,-0.205882 -0.28677,0 -0.5,0.198529 L 2.61765,3.683823 q -0.20589,0.205883 -0.20589,0.492648 0,0.294117 0.20589,0.499999 l 1.52941,1.529412 q 0.19853,0.19853 0.5,0.19853 0.30882,0 0.52941,-0.227942 Q 5.15437,6.15441 5.03676,6.040441 4.91912,5.92647 4.87868,5.882353 4.83828,5.838233 4.76838,5.742647 q -0.0698,-0.09559 -0.0956,-0.1875 -0.0257,-0.09191 -0.0257,-0.202206 0,-0.294117 0.20588,-0.5 0.20588,-0.205882 0.5,-0.205882 0.1103,0 0.20221,0.02573 0.0919,0.02573 0.1875,0.09559 0.0956,0.06985 0.1397,0.110294 0.0441,0.04044 0.15809,0.158089 Q 6.15443,5.154409 6.17649,5.176467 6.41914,4.948526 6.41914,4.639703 z M 13,9.823529 q 0,0.882353 -0.625,1.492647 l -1.08088,1.07353 Q 10.68382,13 9.80147,13 q -0.88971,0 -1.5,-0.625 L 6.78676,10.852941 Q 6.17647,10.242647 6.17647,9.360294 q 0,-0.904412 0.64706,-1.536764 L 6.17647,7.176471 Q 5.54412,7.82353 4.64706,7.82353 q -0.88235,0 -1.5,-0.617648 L 1.617647,5.676471 Q 1,5.058824 1,4.176471 1,3.294118 1.625,2.683824 L 2.70588,1.610294 Q 3.31618,1 4.19853,1 q 0.88971,0 1.5,0.625 l 1.51471,1.522059 q 0.61029,0.610294 0.61029,1.492647 0,0.904412 -0.64706,1.536764 L 7.82353,6.823529 Q 8.45588,6.17647 9.35294,6.17647 q 0.88235,0 1.5,0.617648 l 1.52941,1.529411 Q 13,8.941176 13,9.823529 z&quot;/&gt;&lt;/svg&gt;
          &lt;/a&gt;&lt;/h2&gt;
&lt;ul&gt;
  &lt;li&gt;The try! Swift Tokyo 2026 conference featured not one, but &lt;strong&gt;two&lt;/strong&gt; exciting talks about Embedded Swift:
    &lt;ul&gt;
      &lt;li&gt;&lt;a href=&quot;https://www.youtube.com/watch?v=0OcOFBe0jbQ&quot;&gt;Getting started with Embedded Swift&lt;/a&gt; is a short and accessible introductory talk. Learn about writing Swift using embedded simulators, along with code examples to run Swift code on devices including the Game Boy Advance!&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;https://www.youtube.com/watch?v=vDQ_yxD6JZ4&quot;&gt;Learn by Building: Bare-Metal Programming with Embedded Swift&lt;/a&gt; is a deeper look at Embedded Swift. Follow along by trying the &lt;a href=&quot;https://github.com/kishikawakatsumi/tryswift2026&quot;&gt;sample code for five bare-metal Raspberry Pi Pico examples&lt;/a&gt; that are featured in the talk.&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;Want to learn more about Swift concurrency from engineers who have designed and used its features? Check out this &lt;a href=&quot;https://www.youtube.com/watch?v=E95agtPgaa0&quot;&gt;live online Q&amp;amp;A on Swift concurrency&lt;/a&gt;.&lt;/li&gt;
  &lt;li&gt;Nil Coalescing published a new video on some of the lesser known options for working with optionals in &lt;a href=&quot;https://www.youtube.com/watch?v=qgDIOrKnmuw&quot;&gt;Advanced Techniques for Working with Optionals in Swift&lt;/a&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;new-package-releases&quot; class=&quot;header-with-anchor&quot;&gt;New package releases &lt;a title=&quot;Permalink for New package releases section&quot; href=&quot;#new-package-releases&quot;&gt;
            &lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt; &lt;svg width=&quot;18px&quot; height=&quot;18px&quot; viewBox=&quot;0 0 14 14&quot; role=&quot;img&quot; focusable=&quot;false&quot; aria-hidden=&quot;true&quot; xmlns=&quot;http://www.w3.org/2000/svg&quot;&gt;&lt;path d=&quot;m 11.58824,9.823529 q 0,-0.294117 -0.20589,-0.499999 L 9.85294,7.794118 q -0.20588,-0.205883 -0.5,-0.205883 -0.30882,0 -0.52941,0.235295 0.0221,0.02206 0.13971,0.136029 0.11764,0.113971 0.15808,0.158088 0.0404,0.04412 0.1103,0.139706 0.0698,0.09559 0.0956,0.1875 0.0257,0.09191 0.0257,0.202206 0,0.294117 -0.20588,0.5 -0.20588,0.205882 -0.5,0.205882 -0.1103,0 -0.20221,-0.02573 Q 8.35293,9.301471 8.25733,9.231621 8.16173,9.161771 8.11763,9.121327 8.07353,9.080887 7.95954,8.963238 7.84557,8.845591 7.82351,8.823533 7.58086,9.051474 7.58086,9.360297 q 0,0.294118 0.20588,0.5 l 1.51471,1.522059 q 0.19853,0.19853 0.5,0.19853 0.29412,0 0.5,-0.191177 l 1.08088,-1.073529 q 0.20589,-0.205883 0.20589,-0.492648 z M 6.41912,4.639706 q 0,-0.294118 -0.20588,-0.5 L 4.69853,2.617647 q -0.20588,-0.205882 -0.5,-0.205882 -0.28677,0 -0.5,0.198529 L 2.61765,3.683823 q -0.20589,0.205883 -0.20589,0.492648 0,0.294117 0.20589,0.499999 l 1.52941,1.529412 q 0.19853,0.19853 0.5,0.19853 0.30882,0 0.52941,-0.227942 Q 5.15437,6.15441 5.03676,6.040441 4.91912,5.92647 4.87868,5.882353 4.83828,5.838233 4.76838,5.742647 q -0.0698,-0.09559 -0.0956,-0.1875 -0.0257,-0.09191 -0.0257,-0.202206 0,-0.294117 0.20588,-0.5 0.20588,-0.205882 0.5,-0.205882 0.1103,0 0.20221,0.02573 0.0919,0.02573 0.1875,0.09559 0.0956,0.06985 0.1397,0.110294 0.0441,0.04044 0.15809,0.158089 Q 6.15443,5.154409 6.17649,5.176467 6.41914,4.948526 6.41914,4.639703 z M 13,9.823529 q 0,0.882353 -0.625,1.492647 l -1.08088,1.07353 Q 10.68382,13 9.80147,13 q -0.88971,0 -1.5,-0.625 L 6.78676,10.852941 Q 6.17647,10.242647 6.17647,9.360294 q 0,-0.904412 0.64706,-1.536764 L 6.17647,7.176471 Q 5.54412,7.82353 4.64706,7.82353 q -0.88235,0 -1.5,-0.617648 L 1.617647,5.676471 Q 1,5.058824 1,4.176471 1,3.294118 1.625,2.683824 L 2.70588,1.610294 Q 3.31618,1 4.19853,1 q 0.88971,0 1.5,0.625 l 1.51471,1.522059 q 0.61029,0.610294 0.61029,1.492647 0,0.904412 -0.64706,1.536764 L 7.82353,6.823529 Q 8.45588,6.17647 9.35294,6.17647 q 0.88235,0 1.5,0.617648 l 1.52941,1.529411 Q 13,8.941176 13,9.823529 z&quot;/&gt;&lt;/svg&gt;
          &lt;/a&gt;&lt;/h2&gt;
&lt;ul&gt;
  &lt;li&gt;&lt;a href=&quot;https://github.com/MalkarovPark/IndustrialKit&quot;&gt;IndustrialKit&lt;/a&gt; is a framework for designing, programming, and controlling robotic systems that was recently &lt;a href=&quot;https://forums.swift.org/t/industrialkit-a-swift-framework-for-design-and-control-of-robotic-means-of-production/86168&quot;&gt;discussed on the Swift forums&lt;/a&gt;.&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://forums.swift.org/t/swift-tar-a-pure-swift-tar-archive-read-write-extract-library/85844&quot;&gt;swift-tar&lt;/a&gt; is a pure Swift library for reading, writing, and extracting TAR archives. swift-tar is cross-platform, works without requiring any system framework or Foundation, and supports GNU &amp;amp; PAX extensions.&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://github.com/compnerd/xylem&quot;&gt;Xylem&lt;/a&gt; is a pure Swift XML parser with zero dependencies, covering SAX, DOM, and XPath 1.0.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;swift-evolution&quot; class=&quot;header-with-anchor&quot;&gt;Swift Evolution &lt;a title=&quot;Permalink for Swift Evolution section&quot; href=&quot;#swift-evolution&quot;&gt;
            &lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt; &lt;svg width=&quot;18px&quot; height=&quot;18px&quot; viewBox=&quot;0 0 14 14&quot; role=&quot;img&quot; focusable=&quot;false&quot; aria-hidden=&quot;true&quot; xmlns=&quot;http://www.w3.org/2000/svg&quot;&gt;&lt;path d=&quot;m 11.58824,9.823529 q 0,-0.294117 -0.20589,-0.499999 L 9.85294,7.794118 q -0.20588,-0.205883 -0.5,-0.205883 -0.30882,0 -0.52941,0.235295 0.0221,0.02206 0.13971,0.136029 0.11764,0.113971 0.15808,0.158088 0.0404,0.04412 0.1103,0.139706 0.0698,0.09559 0.0956,0.1875 0.0257,0.09191 0.0257,0.202206 0,0.294117 -0.20588,0.5 -0.20588,0.205882 -0.5,0.205882 -0.1103,0 -0.20221,-0.02573 Q 8.35293,9.301471 8.25733,9.231621 8.16173,9.161771 8.11763,9.121327 8.07353,9.080887 7.95954,8.963238 7.84557,8.845591 7.82351,8.823533 7.58086,9.051474 7.58086,9.360297 q 0,0.294118 0.20588,0.5 l 1.51471,1.522059 q 0.19853,0.19853 0.5,0.19853 0.29412,0 0.5,-0.191177 l 1.08088,-1.073529 q 0.20589,-0.205883 0.20589,-0.492648 z M 6.41912,4.639706 q 0,-0.294118 -0.20588,-0.5 L 4.69853,2.617647 q -0.20588,-0.205882 -0.5,-0.205882 -0.28677,0 -0.5,0.198529 L 2.61765,3.683823 q -0.20589,0.205883 -0.20589,0.492648 0,0.294117 0.20589,0.499999 l 1.52941,1.529412 q 0.19853,0.19853 0.5,0.19853 0.30882,0 0.52941,-0.227942 Q 5.15437,6.15441 5.03676,6.040441 4.91912,5.92647 4.87868,5.882353 4.83828,5.838233 4.76838,5.742647 q -0.0698,-0.09559 -0.0956,-0.1875 -0.0257,-0.09191 -0.0257,-0.202206 0,-0.294117 0.20588,-0.5 0.20588,-0.205882 0.5,-0.205882 0.1103,0 0.20221,0.02573 0.0919,0.02573 0.1875,0.09559 0.0956,0.06985 0.1397,0.110294 0.0441,0.04044 0.15809,0.158089 Q 6.15443,5.154409 6.17649,5.176467 6.41914,4.948526 6.41914,4.639703 z M 13,9.823529 q 0,0.882353 -0.625,1.492647 l -1.08088,1.07353 Q 10.68382,13 9.80147,13 q -0.88971,0 -1.5,-0.625 L 6.78676,10.852941 Q 6.17647,10.242647 6.17647,9.360294 q 0,-0.904412 0.64706,-1.536764 L 6.17647,7.176471 Q 5.54412,7.82353 4.64706,7.82353 q -0.88235,0 -1.5,-0.617648 L 1.617647,5.676471 Q 1,5.058824 1,4.176471 1,3.294118 1.625,2.683824 L 2.70588,1.610294 Q 3.31618,1 4.19853,1 q 0.88971,0 1.5,0.625 l 1.51471,1.522059 q 0.61029,0.610294 0.61029,1.492647 0,0.904412 -0.64706,1.536764 L 7.82353,6.823529 Q 8.45588,6.17647 9.35294,6.17647 q 0.88235,0 1.5,0.617648 l 1.52941,1.529411 Q 13,8.941176 13,9.823529 z&quot;/&gt;&lt;/svg&gt;
          &lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;The Swift project adds new language features through the &lt;a href=&quot;https://www.swift.org/swift-evolution/&quot;&gt;Swift Evolution process&lt;/a&gt;. These are some of the proposals currently under review or recently accepted for a future Swift release.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Under active review:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;&lt;a href=&quot;https://github.com/swiftlang/swift-evolution/blob/main/proposals/0529-filepath-in-stdlib.md&quot;&gt;SE-0529&lt;/a&gt; Add &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;FilePath&lt;/code&gt; to the Standard Library - &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;FilePath&lt;/code&gt; in the swift-system package parses platform-specific path syntax on the developer’s behalf, provides a normalized view of path components, and enables filesystem resolution. However, shipping in an external package means the standard library, Swift runtime, and toolchain libraries such as Foundation cannot depend on it. This proposal adds &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;FilePath&lt;/code&gt; and its associated types to the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Swift&lt;/code&gt; module, alongside essential functionality for construction, decomposition, resolution, and C interoperability.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Recently accepted:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;&lt;a href=&quot;https://github.com/swiftlang/swift-evolution/blob/main/visions/networking.md&quot;&gt;Vision for Networking&lt;/a&gt; - Swift’s networking ecosystem is getting an overhaul. This vision document proposes three initial areas of focus: evolve HTTP APIs including new HTTP client and server implementations, define currency types to reduce duplicated effort and integration friction, and define a unified networking stack.&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://github.com/swiftlang/swift-evolution/blob/main/proposals/0517-uniquebox.md&quot;&gt;SE-0517&lt;/a&gt; &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;UniqueBox&lt;/code&gt; - Sometimes in Swift it’s necessary to manually put something on the heap that wouldn’t otherwise live there. This proposal introduces a new type in the standard library, UniqueBox, which is a smart pointer type that uniquely owns a value on the heap.&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://github.com/swiftlang/swift-evolution/blob/main/proposals/testing/0022-customtestreflectable.md&quot;&gt;ST-0022&lt;/a&gt; Custom reflection during testing - When a test fails, Swift Testing reflects the values involved to help diagnose the failure, but types have no way to customize what appears in that output. This proposal adds a customization point, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;CustomTestReflectable&lt;/code&gt;, for developers to specify exactly what should be included in test output, whether they want to simplify, obscure, extend, or reformat that information.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;one-more-thing&quot; class=&quot;header-with-anchor&quot;&gt;One more thing &lt;a title=&quot;Permalink for One more thing section&quot; href=&quot;#one-more-thing&quot;&gt;
            &lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt; &lt;svg width=&quot;18px&quot; height=&quot;18px&quot; viewBox=&quot;0 0 14 14&quot; role=&quot;img&quot; focusable=&quot;false&quot; aria-hidden=&quot;true&quot; xmlns=&quot;http://www.w3.org/2000/svg&quot;&gt;&lt;path d=&quot;m 11.58824,9.823529 q 0,-0.294117 -0.20589,-0.499999 L 9.85294,7.794118 q -0.20588,-0.205883 -0.5,-0.205883 -0.30882,0 -0.52941,0.235295 0.0221,0.02206 0.13971,0.136029 0.11764,0.113971 0.15808,0.158088 0.0404,0.04412 0.1103,0.139706 0.0698,0.09559 0.0956,0.1875 0.0257,0.09191 0.0257,0.202206 0,0.294117 -0.20588,0.5 -0.20588,0.205882 -0.5,0.205882 -0.1103,0 -0.20221,-0.02573 Q 8.35293,9.301471 8.25733,9.231621 8.16173,9.161771 8.11763,9.121327 8.07353,9.080887 7.95954,8.963238 7.84557,8.845591 7.82351,8.823533 7.58086,9.051474 7.58086,9.360297 q 0,0.294118 0.20588,0.5 l 1.51471,1.522059 q 0.19853,0.19853 0.5,0.19853 0.29412,0 0.5,-0.191177 l 1.08088,-1.073529 q 0.20589,-0.205883 0.20589,-0.492648 z M 6.41912,4.639706 q 0,-0.294118 -0.20588,-0.5 L 4.69853,2.617647 q -0.20588,-0.205882 -0.5,-0.205882 -0.28677,0 -0.5,0.198529 L 2.61765,3.683823 q -0.20589,0.205883 -0.20589,0.492648 0,0.294117 0.20589,0.499999 l 1.52941,1.529412 q 0.19853,0.19853 0.5,0.19853 0.30882,0 0.52941,-0.227942 Q 5.15437,6.15441 5.03676,6.040441 4.91912,5.92647 4.87868,5.882353 4.83828,5.838233 4.76838,5.742647 q -0.0698,-0.09559 -0.0956,-0.1875 -0.0257,-0.09191 -0.0257,-0.202206 0,-0.294117 0.20588,-0.5 0.20588,-0.205882 0.5,-0.205882 0.1103,0 0.20221,0.02573 0.0919,0.02573 0.1875,0.09559 0.0956,0.06985 0.1397,0.110294 0.0441,0.04044 0.15809,0.158089 Q 6.15443,5.154409 6.17649,5.176467 6.41914,4.948526 6.41914,4.639703 z M 13,9.823529 q 0,0.882353 -0.625,1.492647 l -1.08088,1.07353 Q 10.68382,13 9.80147,13 q -0.88971,0 -1.5,-0.625 L 6.78676,10.852941 Q 6.17647,10.242647 6.17647,9.360294 q 0,-0.904412 0.64706,-1.536764 L 6.17647,7.176471 Q 5.54412,7.82353 4.64706,7.82353 q -0.88235,0 -1.5,-0.617648 L 1.617647,5.676471 Q 1,5.058824 1,4.176471 1,3.294118 1.625,2.683824 L 2.70588,1.610294 Q 3.31618,1 4.19853,1 q 0.88971,0 1.5,0.625 l 1.51471,1.522059 q 0.61029,0.610294 0.61029,1.492647 0,0.904412 -0.64706,1.536764 L 7.82353,6.823529 Q 8.45588,6.17647 9.35294,6.17647 q 0.88235,0 1.5,0.617648 l 1.52941,1.529411 Q 13,8.941176 13,9.823529 z&quot;/&gt;&lt;/svg&gt;
          &lt;/a&gt;&lt;/h2&gt;

&lt;p&gt;Have you recently looked at the &lt;a href=&quot;/community/&quot;&gt;Swift.org community page&lt;/a&gt;? It includes updated content, plus a new &lt;a href=&quot;/community/how-we-work/&quot;&gt;How we work&lt;/a&gt; page that describes opportunities to get involved.&lt;/p&gt;
</content>
  </entry>
  
  <entry>
    <title>Expanding Swift's IDE Support</title>
    
      
        
        <author>
        
          <name>Tracy Miranda</name>
        
        </author>
      
    
    <link href="https://swift.org/blog/expanding-swift-ide-support/"/>
    <updated>2026-04-08T06:00:00-04:00</updated>
    <id>https://swift.org/blog/expanding-swift-ide-support/</id>
    <content type="html">&lt;p&gt;You can now write Swift in a broader range of popular IDEs, including Cursor, VSCodium, AWS’s Kiro, and Google’s Antigravity. By leveraging VS Code extension compatibility, these editors tap directly into the Open VSX Registry, where &lt;a href=&quot;https://open-vsx.org/extension/swiftlang/swift-vscode&quot;&gt;the official Swift extension is now live&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Swift has long supported development using &lt;a href=&quot;https://www.swift.org/tools/&quot;&gt;multiple IDEs&lt;/a&gt; including VS Code, Xcode, Neovim, and Emacs. Swift is also compatible with editors that implement the Language Server Protocol (LSP). This growing ecosystem of editor support is particularly significant as Swift continues to show its versatility across platforms and development environments, including agentic IDEs.&lt;/p&gt;

&lt;h2 id=&quot;swift-on-open-vsx&quot; class=&quot;header-with-anchor&quot;&gt;Swift on Open VSX &lt;a title=&quot;Permalink for Swift on Open VSX section&quot; href=&quot;#swift-on-open-vsx&quot;&gt;
            &lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt; &lt;svg width=&quot;18px&quot; height=&quot;18px&quot; viewBox=&quot;0 0 14 14&quot; role=&quot;img&quot; focusable=&quot;false&quot; aria-hidden=&quot;true&quot; xmlns=&quot;http://www.w3.org/2000/svg&quot;&gt;&lt;path d=&quot;m 11.58824,9.823529 q 0,-0.294117 -0.20589,-0.499999 L 9.85294,7.794118 q -0.20588,-0.205883 -0.5,-0.205883 -0.30882,0 -0.52941,0.235295 0.0221,0.02206 0.13971,0.136029 0.11764,0.113971 0.15808,0.158088 0.0404,0.04412 0.1103,0.139706 0.0698,0.09559 0.0956,0.1875 0.0257,0.09191 0.0257,0.202206 0,0.294117 -0.20588,0.5 -0.20588,0.205882 -0.5,0.205882 -0.1103,0 -0.20221,-0.02573 Q 8.35293,9.301471 8.25733,9.231621 8.16173,9.161771 8.11763,9.121327 8.07353,9.080887 7.95954,8.963238 7.84557,8.845591 7.82351,8.823533 7.58086,9.051474 7.58086,9.360297 q 0,0.294118 0.20588,0.5 l 1.51471,1.522059 q 0.19853,0.19853 0.5,0.19853 0.29412,0 0.5,-0.191177 l 1.08088,-1.073529 q 0.20589,-0.205883 0.20589,-0.492648 z M 6.41912,4.639706 q 0,-0.294118 -0.20588,-0.5 L 4.69853,2.617647 q -0.20588,-0.205882 -0.5,-0.205882 -0.28677,0 -0.5,0.198529 L 2.61765,3.683823 q -0.20589,0.205883 -0.20589,0.492648 0,0.294117 0.20589,0.499999 l 1.52941,1.529412 q 0.19853,0.19853 0.5,0.19853 0.30882,0 0.52941,-0.227942 Q 5.15437,6.15441 5.03676,6.040441 4.91912,5.92647 4.87868,5.882353 4.83828,5.838233 4.76838,5.742647 q -0.0698,-0.09559 -0.0956,-0.1875 -0.0257,-0.09191 -0.0257,-0.202206 0,-0.294117 0.20588,-0.5 0.20588,-0.205882 0.5,-0.205882 0.1103,0 0.20221,0.02573 0.0919,0.02573 0.1875,0.09559 0.0956,0.06985 0.1397,0.110294 0.0441,0.04044 0.15809,0.158089 Q 6.15443,5.154409 6.17649,5.176467 6.41914,4.948526 6.41914,4.639703 z M 13,9.823529 q 0,0.882353 -0.625,1.492647 l -1.08088,1.07353 Q 10.68382,13 9.80147,13 q -0.88971,0 -1.5,-0.625 L 6.78676,10.852941 Q 6.17647,10.242647 6.17647,9.360294 q 0,-0.904412 0.64706,-1.536764 L 6.17647,7.176471 Q 5.54412,7.82353 4.64706,7.82353 q -0.88235,0 -1.5,-0.617648 L 1.617647,5.676471 Q 1,5.058824 1,4.176471 1,3.294118 1.625,2.683824 L 2.70588,1.610294 Q 3.31618,1 4.19853,1 q 0.88971,0 1.5,0.625 l 1.51471,1.522059 q 0.61029,0.610294 0.61029,1.492647 0,0.904412 -0.64706,1.536764 L 7.82353,6.823529 Q 8.45588,6.17647 9.35294,6.17647 q 0.88235,0 1.5,0.617648 l 1.52941,1.529411 Q 13,8.941176 13,9.823529 z&quot;/&gt;&lt;/svg&gt;
          &lt;/a&gt;&lt;/h2&gt;

&lt;p&gt;The &lt;a href=&quot;https://marketplace.visualstudio.com/items?itemName=swiftlang.swift-vscode&quot;&gt;Swift extension for VS Code&lt;/a&gt; is now officially available on the Open VSX Registry, the vendor-neutral, open source extension registry hosted by the Eclipse Foundation. The extension adds first-class language support for projects built with Swift Package Manager, enabling seamless cross-platform development on macOS, Linux, and Windows. This milestone brings Swift support, including code completion, refactoring, full debugging support, a test explorer, as well as DocC support, to a broader ecosystem of compatible editors and allows agentic IDEs like Cursor and Antigravity to automatically install Swift, with no manual download required. &lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/images/getting-started-with-cursor-swift/swift-in-cursor.gif&quot; alt=&quot;Swift in Cursor, powered by the Swift extension on Open VSX.&quot; title=&quot;Swift in Cursor, powered by the Swift extension on Open VSX.&quot; style=&quot;width: 100%;&quot; /&gt;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;em&gt;Swift in Cursor, powered by the Swift extension on Open VSX.&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;&lt;/p&gt;

&lt;h2 id=&quot;get-started&quot; class=&quot;header-with-anchor&quot;&gt;Get Started &lt;a title=&quot;Permalink for Get Started section&quot; href=&quot;#get-started&quot;&gt;
            &lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt; &lt;svg width=&quot;18px&quot; height=&quot;18px&quot; viewBox=&quot;0 0 14 14&quot; role=&quot;img&quot; focusable=&quot;false&quot; aria-hidden=&quot;true&quot; xmlns=&quot;http://www.w3.org/2000/svg&quot;&gt;&lt;path d=&quot;m 11.58824,9.823529 q 0,-0.294117 -0.20589,-0.499999 L 9.85294,7.794118 q -0.20588,-0.205883 -0.5,-0.205883 -0.30882,0 -0.52941,0.235295 0.0221,0.02206 0.13971,0.136029 0.11764,0.113971 0.15808,0.158088 0.0404,0.04412 0.1103,0.139706 0.0698,0.09559 0.0956,0.1875 0.0257,0.09191 0.0257,0.202206 0,0.294117 -0.20588,0.5 -0.20588,0.205882 -0.5,0.205882 -0.1103,0 -0.20221,-0.02573 Q 8.35293,9.301471 8.25733,9.231621 8.16173,9.161771 8.11763,9.121327 8.07353,9.080887 7.95954,8.963238 7.84557,8.845591 7.82351,8.823533 7.58086,9.051474 7.58086,9.360297 q 0,0.294118 0.20588,0.5 l 1.51471,1.522059 q 0.19853,0.19853 0.5,0.19853 0.29412,0 0.5,-0.191177 l 1.08088,-1.073529 q 0.20589,-0.205883 0.20589,-0.492648 z M 6.41912,4.639706 q 0,-0.294118 -0.20588,-0.5 L 4.69853,2.617647 q -0.20588,-0.205882 -0.5,-0.205882 -0.28677,0 -0.5,0.198529 L 2.61765,3.683823 q -0.20589,0.205883 -0.20589,0.492648 0,0.294117 0.20589,0.499999 l 1.52941,1.529412 q 0.19853,0.19853 0.5,0.19853 0.30882,0 0.52941,-0.227942 Q 5.15437,6.15441 5.03676,6.040441 4.91912,5.92647 4.87868,5.882353 4.83828,5.838233 4.76838,5.742647 q -0.0698,-0.09559 -0.0956,-0.1875 -0.0257,-0.09191 -0.0257,-0.202206 0,-0.294117 0.20588,-0.5 0.20588,-0.205882 0.5,-0.205882 0.1103,0 0.20221,0.02573 0.0919,0.02573 0.1875,0.09559 0.0956,0.06985 0.1397,0.110294 0.0441,0.04044 0.15809,0.158089 Q 6.15443,5.154409 6.17649,5.176467 6.41914,4.948526 6.41914,4.639703 z M 13,9.823529 q 0,0.882353 -0.625,1.492647 l -1.08088,1.07353 Q 10.68382,13 9.80147,13 q -0.88971,0 -1.5,-0.625 L 6.78676,10.852941 Q 6.17647,10.242647 6.17647,9.360294 q 0,-0.904412 0.64706,-1.536764 L 6.17647,7.176471 Q 5.54412,7.82353 4.64706,7.82353 q -0.88235,0 -1.5,-0.617648 L 1.617647,5.676471 Q 1,5.058824 1,4.176471 1,3.294118 1.625,2.683824 L 2.70588,1.610294 Q 3.31618,1 4.19853,1 q 0.88971,0 1.5,0.625 l 1.51471,1.522059 q 0.61029,0.610294 0.61029,1.492647 0,0.904412 -0.64706,1.536764 L 7.82353,6.823529 Q 8.45588,6.17647 9.35294,6.17647 q 0.88235,0 1.5,0.617648 l 1.52941,1.529411 Q 13,8.941176 13,9.823529 z&quot;/&gt;&lt;/svg&gt;
          &lt;/a&gt;&lt;/h2&gt;

&lt;p&gt;To start using the Swift extension in any Open VSX-compatible editor, simply open the Extensions panel, search for ‘Swift’ and install the extension.&lt;/p&gt;

&lt;p&gt;If you’re using Cursor, getting started is easier than ever. Check out our new dedicated guide: &lt;a href=&quot;/documentation/articles/getting-started-with-cursor-swift.html&quot;&gt;Setting up Cursor for Swift Development&lt;/a&gt;. It walks you through the setup, features and includes how to configure custom Swift skills for your AI workflows.&lt;/p&gt;

&lt;p&gt;Swift now has support for a wider range of modern editors and IDEs to meet developers where they are. Download the extension, try it out in your editor of choice, and don’t forget to &lt;a href=&quot;https://open-vsx.org/extension/swiftlang/swift-vscode/reviews&quot;&gt;share your feedback&lt;/a&gt;!&lt;/p&gt;

</content>
  </entry>
  
  <entry>
    <title>What's new in Swift: March 2026 Edition</title>
    
      
        
        <author>
        
          <name>Owen Voorhees</name>
        
        </author>
      
        
        <author>
        
          <name>Dave Lester</name>
        
        </author>
      
    
    <link href="https://swift.org/blog/whats-new-in-swift-march-2026/"/>
    <updated>2026-03-31T10:30:00-04:00</updated>
    <id>https://swift.org/blog/whats-new-in-swift-march-2026/</id>
    <content type="html">&lt;p&gt;Welcome to “What’s new in Swift,” a curated digest of releases, videos, and discussions in the Swift project and community.&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;/blog/swift-6.3-released/&quot;&gt;Swift 6.3 has been released&lt;/a&gt;, expanding Swift into new domains and improving developer ergonomics. A highlight of its release is work to improve cross-platform build tooling. Owen Voorhees shares an update on that effort:&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;Hi! I’m Owen, a lead engineer on the Core Build team at Apple. Last year we &lt;a href=&quot;/blog/the-next-chapter-in-swift-build-technologies/&quot;&gt;shared our goal&lt;/a&gt; to bring Swift Build to Swift Package Manager, in an effort to deduplicate build technologies within the Swift ecosystem and deliver a consistent build experience across all platforms that Swift supports.&lt;/p&gt;

  &lt;p&gt;Since the announcement, we’ve been working in the open, landing hundreds of patches to improve Swift Build’s support across various platforms including Linux and Windows, and to integrate it deeply in Swift Package Manager. With Swift 6.3, developers have the &lt;a href=&quot;https://docs.swift.org/swiftpm/documentation/packagemanagerdocs/swiftbuildpreview/&quot;&gt;option&lt;/a&gt; to enable this integration and try it out with their packages. To validate parity with the previous build system, we’ve used the package list from swiftpackageindex.com, testing thousands of open source packages with Swift Build.&lt;/p&gt;

  &lt;p&gt;Most recently, &lt;a href=&quot;https://github.com/swiftlang/swift-package-manager/pull/9661&quot;&gt;the main branch of Swift started using Swift Build as its default build system&lt;/a&gt;, paving the way for Swift Build to be the out-of-the-box option for Swift developers in a future Swift release.&lt;/p&gt;

  &lt;p&gt;Over the coming months, we’ll continue sharing our progress and driving down the remaining bugs to bring the build system to parity. We encourage you to &lt;a href=&quot;https://docs.swift.org/swiftpm/documentation/packagemanagerdocs/swiftbuildpreview/&quot;&gt;give it a try&lt;/a&gt; and &lt;a href=&quot;https://docs.swift.org/swiftpm/documentation/packagemanagerdocs/swiftbuildpreview/#Reporting-issues&quot;&gt;file bugs that you encounter&lt;/a&gt;. We’re excited by this progress, and look forward to building future tooling improvements across all platforms and project models that will benefit from this build system.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Now on to other news about Swift:&lt;/p&gt;

&lt;h2 id=&quot;videos-to-watch&quot; class=&quot;header-with-anchor&quot;&gt;Videos to watch &lt;a title=&quot;Permalink for Videos to watch section&quot; href=&quot;#videos-to-watch&quot;&gt;
            &lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt; &lt;svg width=&quot;18px&quot; height=&quot;18px&quot; viewBox=&quot;0 0 14 14&quot; role=&quot;img&quot; focusable=&quot;false&quot; aria-hidden=&quot;true&quot; xmlns=&quot;http://www.w3.org/2000/svg&quot;&gt;&lt;path d=&quot;m 11.58824,9.823529 q 0,-0.294117 -0.20589,-0.499999 L 9.85294,7.794118 q -0.20588,-0.205883 -0.5,-0.205883 -0.30882,0 -0.52941,0.235295 0.0221,0.02206 0.13971,0.136029 0.11764,0.113971 0.15808,0.158088 0.0404,0.04412 0.1103,0.139706 0.0698,0.09559 0.0956,0.1875 0.0257,0.09191 0.0257,0.202206 0,0.294117 -0.20588,0.5 -0.20588,0.205882 -0.5,0.205882 -0.1103,0 -0.20221,-0.02573 Q 8.35293,9.301471 8.25733,9.231621 8.16173,9.161771 8.11763,9.121327 8.07353,9.080887 7.95954,8.963238 7.84557,8.845591 7.82351,8.823533 7.58086,9.051474 7.58086,9.360297 q 0,0.294118 0.20588,0.5 l 1.51471,1.522059 q 0.19853,0.19853 0.5,0.19853 0.29412,0 0.5,-0.191177 l 1.08088,-1.073529 q 0.20589,-0.205883 0.20589,-0.492648 z M 6.41912,4.639706 q 0,-0.294118 -0.20588,-0.5 L 4.69853,2.617647 q -0.20588,-0.205882 -0.5,-0.205882 -0.28677,0 -0.5,0.198529 L 2.61765,3.683823 q -0.20589,0.205883 -0.20589,0.492648 0,0.294117 0.20589,0.499999 l 1.52941,1.529412 q 0.19853,0.19853 0.5,0.19853 0.30882,0 0.52941,-0.227942 Q 5.15437,6.15441 5.03676,6.040441 4.91912,5.92647 4.87868,5.882353 4.83828,5.838233 4.76838,5.742647 q -0.0698,-0.09559 -0.0956,-0.1875 -0.0257,-0.09191 -0.0257,-0.202206 0,-0.294117 0.20588,-0.5 0.20588,-0.205882 0.5,-0.205882 0.1103,0 0.20221,0.02573 0.0919,0.02573 0.1875,0.09559 0.0956,0.06985 0.1397,0.110294 0.0441,0.04044 0.15809,0.158089 Q 6.15443,5.154409 6.17649,5.176467 6.41914,4.948526 6.41914,4.639703 z M 13,9.823529 q 0,0.882353 -0.625,1.492647 l -1.08088,1.07353 Q 10.68382,13 9.80147,13 q -0.88971,0 -1.5,-0.625 L 6.78676,10.852941 Q 6.17647,10.242647 6.17647,9.360294 q 0,-0.904412 0.64706,-1.536764 L 6.17647,7.176471 Q 5.54412,7.82353 4.64706,7.82353 q -0.88235,0 -1.5,-0.617648 L 1.617647,5.676471 Q 1,5.058824 1,4.176471 1,3.294118 1.625,2.683824 L 2.70588,1.610294 Q 3.31618,1 4.19853,1 q 0.88971,0 1.5,0.625 l 1.51471,1.522059 q 0.61029,0.610294 0.61029,1.492647 0,0.904412 -0.64706,1.536764 L 7.82353,6.823529 Q 8.45588,6.17647 9.35294,6.17647 q 0.88235,0 1.5,0.617648 l 1.52941,1.529411 Q 13,8.941176 13,9.823529 z&quot;/&gt;&lt;/svg&gt;
          &lt;/a&gt;&lt;/h2&gt;
&lt;ul&gt;
  &lt;li&gt;Interested in Swift for systems programming? &lt;a href=&quot;https://www.youtube.com/live/TRw0bsrtCjA?t=13975s&quot;&gt;The -ization of Containerization&lt;/a&gt;, presented at SCaLE, covers the Containerization project and their experience adopting Swift.&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://www.youtube.com/watch?v=wCdE8sPJwTo&quot;&gt;Swift community meetup #8&lt;/a&gt; featured two talks: real-time computer vision on NVIDIA Jetson, and a production AI data pipeline built with Vapor.&lt;/li&gt;
  &lt;li&gt;A &lt;a href=&quot;https://www.youtube.com/watch?v=cUu0M5ewpPM&quot;&gt;new interview with Matt Massicotte&lt;/a&gt; on the Swift Academy podcast goes in-depth on Swift Concurrency.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;community-highlights&quot; class=&quot;header-with-anchor&quot;&gt;Community highlights &lt;a title=&quot;Permalink for Community highlights section&quot; href=&quot;#community-highlights&quot;&gt;
            &lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt; &lt;svg width=&quot;18px&quot; height=&quot;18px&quot; viewBox=&quot;0 0 14 14&quot; role=&quot;img&quot; focusable=&quot;false&quot; aria-hidden=&quot;true&quot; xmlns=&quot;http://www.w3.org/2000/svg&quot;&gt;&lt;path d=&quot;m 11.58824,9.823529 q 0,-0.294117 -0.20589,-0.499999 L 9.85294,7.794118 q -0.20588,-0.205883 -0.5,-0.205883 -0.30882,0 -0.52941,0.235295 0.0221,0.02206 0.13971,0.136029 0.11764,0.113971 0.15808,0.158088 0.0404,0.04412 0.1103,0.139706 0.0698,0.09559 0.0956,0.1875 0.0257,0.09191 0.0257,0.202206 0,0.294117 -0.20588,0.5 -0.20588,0.205882 -0.5,0.205882 -0.1103,0 -0.20221,-0.02573 Q 8.35293,9.301471 8.25733,9.231621 8.16173,9.161771 8.11763,9.121327 8.07353,9.080887 7.95954,8.963238 7.84557,8.845591 7.82351,8.823533 7.58086,9.051474 7.58086,9.360297 q 0,0.294118 0.20588,0.5 l 1.51471,1.522059 q 0.19853,0.19853 0.5,0.19853 0.29412,0 0.5,-0.191177 l 1.08088,-1.073529 q 0.20589,-0.205883 0.20589,-0.492648 z M 6.41912,4.639706 q 0,-0.294118 -0.20588,-0.5 L 4.69853,2.617647 q -0.20588,-0.205882 -0.5,-0.205882 -0.28677,0 -0.5,0.198529 L 2.61765,3.683823 q -0.20589,0.205883 -0.20589,0.492648 0,0.294117 0.20589,0.499999 l 1.52941,1.529412 q 0.19853,0.19853 0.5,0.19853 0.30882,0 0.52941,-0.227942 Q 5.15437,6.15441 5.03676,6.040441 4.91912,5.92647 4.87868,5.882353 4.83828,5.838233 4.76838,5.742647 q -0.0698,-0.09559 -0.0956,-0.1875 -0.0257,-0.09191 -0.0257,-0.202206 0,-0.294117 0.20588,-0.5 0.20588,-0.205882 0.5,-0.205882 0.1103,0 0.20221,0.02573 0.0919,0.02573 0.1875,0.09559 0.0956,0.06985 0.1397,0.110294 0.0441,0.04044 0.15809,0.158089 Q 6.15443,5.154409 6.17649,5.176467 6.41914,4.948526 6.41914,4.639703 z M 13,9.823529 q 0,0.882353 -0.625,1.492647 l -1.08088,1.07353 Q 10.68382,13 9.80147,13 q -0.88971,0 -1.5,-0.625 L 6.78676,10.852941 Q 6.17647,10.242647 6.17647,9.360294 q 0,-0.904412 0.64706,-1.536764 L 6.17647,7.176471 Q 5.54412,7.82353 4.64706,7.82353 q -0.88235,0 -1.5,-0.617648 L 1.617647,5.676471 Q 1,5.058824 1,4.176471 1,3.294118 1.625,2.683824 L 2.70588,1.610294 Q 3.31618,1 4.19853,1 q 0.88971,0 1.5,0.625 l 1.51471,1.522059 q 0.61029,0.610294 0.61029,1.492647 0,0.904412 -0.64706,1.536764 L 7.82353,6.823529 Q 8.45588,6.17647 9.35294,6.17647 q 0.88235,0 1.5,0.617648 l 1.52941,1.529411 Q 13,8.941176 13,9.823529 z&quot;/&gt;&lt;/svg&gt;
          &lt;/a&gt;&lt;/h2&gt;
&lt;ul&gt;
  &lt;li&gt;How can you gradually deprecate APIs ahead of a major release? Point-Free blogged &lt;a href=&quot;https://www.pointfree.co/blog/posts/203-hard-deprecations-and-soft-landings-with-swiftpm-traits&quot;&gt;Hard Deprecations and Soft Landings with SwiftPM Traits&lt;/a&gt;, a clever approach to solving a common API deprecation problem.&lt;/li&gt;
  &lt;li&gt;Daniel Jilg shared &lt;a href=&quot;/blog/building-privacy-first-analytics-with-swift/&quot;&gt;TelemetryDeck’s adoption story&lt;/a&gt; on the Swift blog, including how they use Swift and Vapor for backend services.&lt;/li&gt;
  &lt;li&gt;The March 2026 &lt;a href=&quot;https://forums.swift.org/t/swift-for-wasm-march-2026-updates/85725&quot;&gt;Swift for Wasm updates&lt;/a&gt; are out, highlighting a new JavaScriptKit release with BridgeJS improvements, and continued work in WasmKit.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;swift-evolution&quot; class=&quot;header-with-anchor&quot;&gt;Swift Evolution &lt;a title=&quot;Permalink for Swift Evolution section&quot; href=&quot;#swift-evolution&quot;&gt;
            &lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt; &lt;svg width=&quot;18px&quot; height=&quot;18px&quot; viewBox=&quot;0 0 14 14&quot; role=&quot;img&quot; focusable=&quot;false&quot; aria-hidden=&quot;true&quot; xmlns=&quot;http://www.w3.org/2000/svg&quot;&gt;&lt;path d=&quot;m 11.58824,9.823529 q 0,-0.294117 -0.20589,-0.499999 L 9.85294,7.794118 q -0.20588,-0.205883 -0.5,-0.205883 -0.30882,0 -0.52941,0.235295 0.0221,0.02206 0.13971,0.136029 0.11764,0.113971 0.15808,0.158088 0.0404,0.04412 0.1103,0.139706 0.0698,0.09559 0.0956,0.1875 0.0257,0.09191 0.0257,0.202206 0,0.294117 -0.20588,0.5 -0.20588,0.205882 -0.5,0.205882 -0.1103,0 -0.20221,-0.02573 Q 8.35293,9.301471 8.25733,9.231621 8.16173,9.161771 8.11763,9.121327 8.07353,9.080887 7.95954,8.963238 7.84557,8.845591 7.82351,8.823533 7.58086,9.051474 7.58086,9.360297 q 0,0.294118 0.20588,0.5 l 1.51471,1.522059 q 0.19853,0.19853 0.5,0.19853 0.29412,0 0.5,-0.191177 l 1.08088,-1.073529 q 0.20589,-0.205883 0.20589,-0.492648 z M 6.41912,4.639706 q 0,-0.294118 -0.20588,-0.5 L 4.69853,2.617647 q -0.20588,-0.205882 -0.5,-0.205882 -0.28677,0 -0.5,0.198529 L 2.61765,3.683823 q -0.20589,0.205883 -0.20589,0.492648 0,0.294117 0.20589,0.499999 l 1.52941,1.529412 q 0.19853,0.19853 0.5,0.19853 0.30882,0 0.52941,-0.227942 Q 5.15437,6.15441 5.03676,6.040441 4.91912,5.92647 4.87868,5.882353 4.83828,5.838233 4.76838,5.742647 q -0.0698,-0.09559 -0.0956,-0.1875 -0.0257,-0.09191 -0.0257,-0.202206 0,-0.294117 0.20588,-0.5 0.20588,-0.205882 0.5,-0.205882 0.1103,0 0.20221,0.02573 0.0919,0.02573 0.1875,0.09559 0.0956,0.06985 0.1397,0.110294 0.0441,0.04044 0.15809,0.158089 Q 6.15443,5.154409 6.17649,5.176467 6.41914,4.948526 6.41914,4.639703 z M 13,9.823529 q 0,0.882353 -0.625,1.492647 l -1.08088,1.07353 Q 10.68382,13 9.80147,13 q -0.88971,0 -1.5,-0.625 L 6.78676,10.852941 Q 6.17647,10.242647 6.17647,9.360294 q 0,-0.904412 0.64706,-1.536764 L 6.17647,7.176471 Q 5.54412,7.82353 4.64706,7.82353 q -0.88235,0 -1.5,-0.617648 L 1.617647,5.676471 Q 1,5.058824 1,4.176471 1,3.294118 1.625,2.683824 L 2.70588,1.610294 Q 3.31618,1 4.19853,1 q 0.88971,0 1.5,0.625 l 1.51471,1.522059 q 0.61029,0.610294 0.61029,1.492647 0,0.904412 -0.64706,1.536764 L 7.82353,6.823529 Q 8.45588,6.17647 9.35294,6.17647 q 0.88235,0 1.5,0.617648 l 1.52941,1.529411 Q 13,8.941176 13,9.823529 z&quot;/&gt;&lt;/svg&gt;
          &lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;The Swift project adds new language features through the &lt;a href=&quot;/swift-evolution/&quot;&gt;Swift Evolution process&lt;/a&gt;. These are some of the proposals currently under review or recently accepted for a future Swift release.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Under active review:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;&lt;a href=&quot;https://github.com/swiftlang/swift-evolution/blob/main/proposals/0522-source-warning-control.md&quot;&gt;SE-0522&lt;/a&gt; Source-Level Control Over Compiler Warnings - Swift lets you configure warning behavior at the module level using compiler flags, but that’s an all-or-nothing approach. This proposal adds fine-grained warning control: a &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;@warn&lt;/code&gt; attribute that lets you override warning behavior for a specific diagnostic group within the scope of a single declaration, with support for escalating it to an error, downgrading it to a warning, or suppressing it entirely, without affecting the rest of your module.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Recently accepted:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;&lt;a href=&quot;https://github.com/swiftlang/swift-evolution/blob/main/proposals/0509-swift-sboms-via-swiftpm.md&quot;&gt;SE-0509&lt;/a&gt; Software Bill of Materials (SBOM) Generation for Swift Package Manager - An SBOM is a standardized inventory of all the software components in a project, increasingly required for security auditing and regulatory compliance. This proposal adds native SBOM generation to SwiftPM as both a &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;--sbom-spec&lt;/code&gt; flag on &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;swift build&lt;/code&gt;, and a separate &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;swift package generate-sbom&lt;/code&gt; subcommand, with support for the CycloneDX and SPDX formats.&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://github.com/swiftlang/swift-evolution/blob/main/proposals/testing/0021-targeted-interoperability-swift-testing-and-xctest.md&quot;&gt;ST-0021&lt;/a&gt; Targeted Interoperability between Swift Testing and XCTest - When migrating from XCTest to Swift Testing, it’s common to call existing XCTest helper functions from new Swift Testing tests. Today, an &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;XCTAssert&lt;/code&gt; failure inside a Swift Testing test is silently ignored. This proposal fixes that: XCTest APIs will work as expected when called in Swift Testing, and Swift Testing APIs will work as expected when called in XCTest, if XCTest already provides similar functionality.&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://github.com/swiftlang/swift-evolution/blob/main/proposals/0515-noncopyable-reduce.md&quot;&gt;SE-0515&lt;/a&gt; Allow &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;reduce&lt;/code&gt; to produce noncopyable results - Swift’s &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;reduce&lt;/code&gt; currently requires its initial value to be copyable, making it incompatible with noncopyable types. This proposal updates &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;reduce&lt;/code&gt; to support noncopyable initial values and results, and changes it to consume rather than borrow the initial value, eliminating an unnecessary copy even for copyable types.&lt;/li&gt;
&lt;/ul&gt;
</content>
  </entry>
  
  <entry>
    <title>Swift 6.3 Released</title>
    
      
        
        <author>
        
          <name>Holly Borla</name>
        
        </author>
      
        
        <author>
        
          <name>Joe Heck</name>
        
        </author>
      
    
    <link href="https://swift.org/blog/swift-6.3-released/"/>
    <updated>2026-03-24T06:00:00-04:00</updated>
    <id>https://swift.org/blog/swift-6.3-released/</id>
    <content type="html">&lt;p&gt;Swift is designed to be the language you reach for at every layer of the software stack. Whether you’re building embedded firmware, internet-scale services, or full-featured mobile apps, Swift delivers strong safety guarantees, performance control when you need it, and expressive language features and APIs.&lt;/p&gt;

&lt;p&gt;Swift 6.3 makes these benefits more accessible across the stack. This release expands Swift into new domains and improves developer ergonomics across the board, featuring:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;More flexible C interoperability&lt;/li&gt;
  &lt;li&gt;Improvements to cross-platform build tooling&lt;/li&gt;
  &lt;li&gt;Improvements for using Swift in embedded environments&lt;/li&gt;
  &lt;li&gt;An official Swift SDK for Android&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Read on for an overview of the changes and next steps to get started.&lt;/p&gt;

&lt;h2 id=&quot;language-and-standard-library&quot; class=&quot;header-with-anchor&quot;&gt;Language and Standard Library &lt;a title=&quot;Permalink for Language and Standard Library section&quot; href=&quot;#language-and-standard-library&quot;&gt;
            &lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt; &lt;svg width=&quot;18px&quot; height=&quot;18px&quot; viewBox=&quot;0 0 14 14&quot; role=&quot;img&quot; focusable=&quot;false&quot; aria-hidden=&quot;true&quot; xmlns=&quot;http://www.w3.org/2000/svg&quot;&gt;&lt;path d=&quot;m 11.58824,9.823529 q 0,-0.294117 -0.20589,-0.499999 L 9.85294,7.794118 q -0.20588,-0.205883 -0.5,-0.205883 -0.30882,0 -0.52941,0.235295 0.0221,0.02206 0.13971,0.136029 0.11764,0.113971 0.15808,0.158088 0.0404,0.04412 0.1103,0.139706 0.0698,0.09559 0.0956,0.1875 0.0257,0.09191 0.0257,0.202206 0,0.294117 -0.20588,0.5 -0.20588,0.205882 -0.5,0.205882 -0.1103,0 -0.20221,-0.02573 Q 8.35293,9.301471 8.25733,9.231621 8.16173,9.161771 8.11763,9.121327 8.07353,9.080887 7.95954,8.963238 7.84557,8.845591 7.82351,8.823533 7.58086,9.051474 7.58086,9.360297 q 0,0.294118 0.20588,0.5 l 1.51471,1.522059 q 0.19853,0.19853 0.5,0.19853 0.29412,0 0.5,-0.191177 l 1.08088,-1.073529 q 0.20589,-0.205883 0.20589,-0.492648 z M 6.41912,4.639706 q 0,-0.294118 -0.20588,-0.5 L 4.69853,2.617647 q -0.20588,-0.205882 -0.5,-0.205882 -0.28677,0 -0.5,0.198529 L 2.61765,3.683823 q -0.20589,0.205883 -0.20589,0.492648 0,0.294117 0.20589,0.499999 l 1.52941,1.529412 q 0.19853,0.19853 0.5,0.19853 0.30882,0 0.52941,-0.227942 Q 5.15437,6.15441 5.03676,6.040441 4.91912,5.92647 4.87868,5.882353 4.83828,5.838233 4.76838,5.742647 q -0.0698,-0.09559 -0.0956,-0.1875 -0.0257,-0.09191 -0.0257,-0.202206 0,-0.294117 0.20588,-0.5 0.20588,-0.205882 0.5,-0.205882 0.1103,0 0.20221,0.02573 0.0919,0.02573 0.1875,0.09559 0.0956,0.06985 0.1397,0.110294 0.0441,0.04044 0.15809,0.158089 Q 6.15443,5.154409 6.17649,5.176467 6.41914,4.948526 6.41914,4.639703 z M 13,9.823529 q 0,0.882353 -0.625,1.492647 l -1.08088,1.07353 Q 10.68382,13 9.80147,13 q -0.88971,0 -1.5,-0.625 L 6.78676,10.852941 Q 6.17647,10.242647 6.17647,9.360294 q 0,-0.904412 0.64706,-1.536764 L 6.17647,7.176471 Q 5.54412,7.82353 4.64706,7.82353 q -0.88235,0 -1.5,-0.617648 L 1.617647,5.676471 Q 1,5.058824 1,4.176471 1,3.294118 1.625,2.683824 L 2.70588,1.610294 Q 3.31618,1 4.19853,1 q 0.88971,0 1.5,0.625 l 1.51471,1.522059 q 0.61029,0.610294 0.61029,1.492647 0,0.904412 -0.64706,1.536764 L 7.82353,6.823529 Q 8.45588,6.17647 9.35294,6.17647 q 0.88235,0 1.5,0.617648 l 1.52941,1.529411 Q 13,8.941176 13,9.823529 z&quot;/&gt;&lt;/svg&gt;
          &lt;/a&gt;&lt;/h2&gt;

&lt;h3 id=&quot;c-interoperability&quot; class=&quot;header-with-anchor&quot;&gt;C interoperability &lt;a title=&quot;Permalink for C interoperability section&quot; href=&quot;#c-interoperability&quot;&gt;
            &lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt; &lt;svg width=&quot;18px&quot; height=&quot;18px&quot; viewBox=&quot;0 0 14 14&quot; role=&quot;img&quot; focusable=&quot;false&quot; aria-hidden=&quot;true&quot; xmlns=&quot;http://www.w3.org/2000/svg&quot;&gt;&lt;path d=&quot;m 11.58824,9.823529 q 0,-0.294117 -0.20589,-0.499999 L 9.85294,7.794118 q -0.20588,-0.205883 -0.5,-0.205883 -0.30882,0 -0.52941,0.235295 0.0221,0.02206 0.13971,0.136029 0.11764,0.113971 0.15808,0.158088 0.0404,0.04412 0.1103,0.139706 0.0698,0.09559 0.0956,0.1875 0.0257,0.09191 0.0257,0.202206 0,0.294117 -0.20588,0.5 -0.20588,0.205882 -0.5,0.205882 -0.1103,0 -0.20221,-0.02573 Q 8.35293,9.301471 8.25733,9.231621 8.16173,9.161771 8.11763,9.121327 8.07353,9.080887 7.95954,8.963238 7.84557,8.845591 7.82351,8.823533 7.58086,9.051474 7.58086,9.360297 q 0,0.294118 0.20588,0.5 l 1.51471,1.522059 q 0.19853,0.19853 0.5,0.19853 0.29412,0 0.5,-0.191177 l 1.08088,-1.073529 q 0.20589,-0.205883 0.20589,-0.492648 z M 6.41912,4.639706 q 0,-0.294118 -0.20588,-0.5 L 4.69853,2.617647 q -0.20588,-0.205882 -0.5,-0.205882 -0.28677,0 -0.5,0.198529 L 2.61765,3.683823 q -0.20589,0.205883 -0.20589,0.492648 0,0.294117 0.20589,0.499999 l 1.52941,1.529412 q 0.19853,0.19853 0.5,0.19853 0.30882,0 0.52941,-0.227942 Q 5.15437,6.15441 5.03676,6.040441 4.91912,5.92647 4.87868,5.882353 4.83828,5.838233 4.76838,5.742647 q -0.0698,-0.09559 -0.0956,-0.1875 -0.0257,-0.09191 -0.0257,-0.202206 0,-0.294117 0.20588,-0.5 0.20588,-0.205882 0.5,-0.205882 0.1103,0 0.20221,0.02573 0.0919,0.02573 0.1875,0.09559 0.0956,0.06985 0.1397,0.110294 0.0441,0.04044 0.15809,0.158089 Q 6.15443,5.154409 6.17649,5.176467 6.41914,4.948526 6.41914,4.639703 z M 13,9.823529 q 0,0.882353 -0.625,1.492647 l -1.08088,1.07353 Q 10.68382,13 9.80147,13 q -0.88971,0 -1.5,-0.625 L 6.78676,10.852941 Q 6.17647,10.242647 6.17647,9.360294 q 0,-0.904412 0.64706,-1.536764 L 6.17647,7.176471 Q 5.54412,7.82353 4.64706,7.82353 q -0.88235,0 -1.5,-0.617648 L 1.617647,5.676471 Q 1,5.058824 1,4.176471 1,3.294118 1.625,2.683824 L 2.70588,1.610294 Q 3.31618,1 4.19853,1 q 0.88971,0 1.5,0.625 l 1.51471,1.522059 q 0.61029,0.610294 0.61029,1.492647 0,0.904412 -0.64706,1.536764 L 7.82353,6.823529 Q 8.45588,6.17647 9.35294,6.17647 q 0.88235,0 1.5,0.617648 l 1.52941,1.529411 Q 13,8.941176 13,9.823529 z&quot;/&gt;&lt;/svg&gt;
          &lt;/a&gt;&lt;/h3&gt;

&lt;p&gt;Swift 6.3 introduces the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;@c&lt;/code&gt; attribute, which lets you expose Swift functions and enums to C code in your project. Annotating a function or enum with &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;@c&lt;/code&gt; prompts Swift to include a corresponding declaration in the generated C header that you can include in your C/C++ files:&lt;/p&gt;

&lt;div class=&quot;language-swift highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;kd&quot;&gt;@c&lt;/span&gt;
&lt;span class=&quot;kd&quot;&gt;func&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;callFromC&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;...&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;div class=&quot;language-c highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;c1&quot;&gt;// Generated C header&lt;/span&gt;

&lt;span class=&quot;kt&quot;&gt;void&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;callFromC&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;void&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;You can provide a custom name to use for the generated C declaration:&lt;/p&gt;

&lt;div class=&quot;language-swift highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;kd&quot;&gt;@c&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;MyLibrary_callFromC&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;kd&quot;&gt;func&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;callFromC&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;...&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;div class=&quot;language-c highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;c1&quot;&gt;// Generated C header&lt;/span&gt;

&lt;span class=&quot;kt&quot;&gt;void&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;MyLibrary_callFromC&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;void&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;@c&lt;/code&gt; also works together with &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;@implementation&lt;/code&gt;. This lets you provide a Swift implementation for a function declared in a C header:&lt;/p&gt;

&lt;div class=&quot;language-c highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;c1&quot;&gt;// C header&lt;/span&gt;

&lt;span class=&quot;kt&quot;&gt;void&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;callFromC&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;void&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;div class=&quot;language-swift highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;c1&quot;&gt;// Implementation written in Swift&lt;/span&gt;

&lt;span class=&quot;kd&quot;&gt;@c&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;@implementation&lt;/span&gt;
&lt;span class=&quot;kd&quot;&gt;func&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;callFromC&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;...&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;When using &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;@c&lt;/code&gt; together with &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;@implementation&lt;/code&gt;, Swift will validate that the Swift function matches a pre-existing declaration in a C header, rather than including a C declaration in the generated header.&lt;/p&gt;

&lt;h3 id=&quot;module-name-selectors&quot; class=&quot;header-with-anchor&quot;&gt;Module name selectors &lt;a title=&quot;Permalink for Module name selectors section&quot; href=&quot;#module-name-selectors&quot;&gt;
            &lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt; &lt;svg width=&quot;18px&quot; height=&quot;18px&quot; viewBox=&quot;0 0 14 14&quot; role=&quot;img&quot; focusable=&quot;false&quot; aria-hidden=&quot;true&quot; xmlns=&quot;http://www.w3.org/2000/svg&quot;&gt;&lt;path d=&quot;m 11.58824,9.823529 q 0,-0.294117 -0.20589,-0.499999 L 9.85294,7.794118 q -0.20588,-0.205883 -0.5,-0.205883 -0.30882,0 -0.52941,0.235295 0.0221,0.02206 0.13971,0.136029 0.11764,0.113971 0.15808,0.158088 0.0404,0.04412 0.1103,0.139706 0.0698,0.09559 0.0956,0.1875 0.0257,0.09191 0.0257,0.202206 0,0.294117 -0.20588,0.5 -0.20588,0.205882 -0.5,0.205882 -0.1103,0 -0.20221,-0.02573 Q 8.35293,9.301471 8.25733,9.231621 8.16173,9.161771 8.11763,9.121327 8.07353,9.080887 7.95954,8.963238 7.84557,8.845591 7.82351,8.823533 7.58086,9.051474 7.58086,9.360297 q 0,0.294118 0.20588,0.5 l 1.51471,1.522059 q 0.19853,0.19853 0.5,0.19853 0.29412,0 0.5,-0.191177 l 1.08088,-1.073529 q 0.20589,-0.205883 0.20589,-0.492648 z M 6.41912,4.639706 q 0,-0.294118 -0.20588,-0.5 L 4.69853,2.617647 q -0.20588,-0.205882 -0.5,-0.205882 -0.28677,0 -0.5,0.198529 L 2.61765,3.683823 q -0.20589,0.205883 -0.20589,0.492648 0,0.294117 0.20589,0.499999 l 1.52941,1.529412 q 0.19853,0.19853 0.5,0.19853 0.30882,0 0.52941,-0.227942 Q 5.15437,6.15441 5.03676,6.040441 4.91912,5.92647 4.87868,5.882353 4.83828,5.838233 4.76838,5.742647 q -0.0698,-0.09559 -0.0956,-0.1875 -0.0257,-0.09191 -0.0257,-0.202206 0,-0.294117 0.20588,-0.5 0.20588,-0.205882 0.5,-0.205882 0.1103,0 0.20221,0.02573 0.0919,0.02573 0.1875,0.09559 0.0956,0.06985 0.1397,0.110294 0.0441,0.04044 0.15809,0.158089 Q 6.15443,5.154409 6.17649,5.176467 6.41914,4.948526 6.41914,4.639703 z M 13,9.823529 q 0,0.882353 -0.625,1.492647 l -1.08088,1.07353 Q 10.68382,13 9.80147,13 q -0.88971,0 -1.5,-0.625 L 6.78676,10.852941 Q 6.17647,10.242647 6.17647,9.360294 q 0,-0.904412 0.64706,-1.536764 L 6.17647,7.176471 Q 5.54412,7.82353 4.64706,7.82353 q -0.88235,0 -1.5,-0.617648 L 1.617647,5.676471 Q 1,5.058824 1,4.176471 1,3.294118 1.625,2.683824 L 2.70588,1.610294 Q 3.31618,1 4.19853,1 q 0.88971,0 1.5,0.625 l 1.51471,1.522059 q 0.61029,0.610294 0.61029,1.492647 0,0.904412 -0.64706,1.536764 L 7.82353,6.823529 Q 8.45588,6.17647 9.35294,6.17647 q 0.88235,0 1.5,0.617648 l 1.52941,1.529411 Q 13,8.941176 13,9.823529 z&quot;/&gt;&lt;/svg&gt;
          &lt;/a&gt;&lt;/h3&gt;

&lt;p&gt;Swift 6.3 introduces &lt;em&gt;module selectors&lt;/em&gt; to specify which imported module Swift should look in for an API used in your code. If you import more than one module that provides API with the same name, module selectors let you disambiguate which API to use:&lt;/p&gt;

&lt;div class=&quot;language-swift highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;kd&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;ModuleA&lt;/span&gt;
&lt;span class=&quot;kd&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;ModuleB&lt;/span&gt;

&lt;span class=&quot;k&quot;&gt;let&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;x&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;ModuleA&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;getValue&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;// Call &apos;getValue&apos; from ModuleA&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;let&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;y&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;ModuleB&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;getValue&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;// Call &apos;getValue&apos; from ModuleB&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Swift 6.3 also enables using the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Swift&lt;/code&gt; module name to access concurrency and String processing library APIs:&lt;/p&gt;

&lt;div class=&quot;language-swift highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;k&quot;&gt;let&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;task&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;Swift&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;Task&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
  &lt;span class=&quot;c1&quot;&gt;// async work&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h3 id=&quot;performance-control-for-library-apis&quot; class=&quot;header-with-anchor&quot;&gt;Performance control for library APIs &lt;a title=&quot;Permalink for Performance control for library APIs section&quot; href=&quot;#performance-control-for-library-apis&quot;&gt;
            &lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt; &lt;svg width=&quot;18px&quot; height=&quot;18px&quot; viewBox=&quot;0 0 14 14&quot; role=&quot;img&quot; focusable=&quot;false&quot; aria-hidden=&quot;true&quot; xmlns=&quot;http://www.w3.org/2000/svg&quot;&gt;&lt;path d=&quot;m 11.58824,9.823529 q 0,-0.294117 -0.20589,-0.499999 L 9.85294,7.794118 q -0.20588,-0.205883 -0.5,-0.205883 -0.30882,0 -0.52941,0.235295 0.0221,0.02206 0.13971,0.136029 0.11764,0.113971 0.15808,0.158088 0.0404,0.04412 0.1103,0.139706 0.0698,0.09559 0.0956,0.1875 0.0257,0.09191 0.0257,0.202206 0,0.294117 -0.20588,0.5 -0.20588,0.205882 -0.5,0.205882 -0.1103,0 -0.20221,-0.02573 Q 8.35293,9.301471 8.25733,9.231621 8.16173,9.161771 8.11763,9.121327 8.07353,9.080887 7.95954,8.963238 7.84557,8.845591 7.82351,8.823533 7.58086,9.051474 7.58086,9.360297 q 0,0.294118 0.20588,0.5 l 1.51471,1.522059 q 0.19853,0.19853 0.5,0.19853 0.29412,0 0.5,-0.191177 l 1.08088,-1.073529 q 0.20589,-0.205883 0.20589,-0.492648 z M 6.41912,4.639706 q 0,-0.294118 -0.20588,-0.5 L 4.69853,2.617647 q -0.20588,-0.205882 -0.5,-0.205882 -0.28677,0 -0.5,0.198529 L 2.61765,3.683823 q -0.20589,0.205883 -0.20589,0.492648 0,0.294117 0.20589,0.499999 l 1.52941,1.529412 q 0.19853,0.19853 0.5,0.19853 0.30882,0 0.52941,-0.227942 Q 5.15437,6.15441 5.03676,6.040441 4.91912,5.92647 4.87868,5.882353 4.83828,5.838233 4.76838,5.742647 q -0.0698,-0.09559 -0.0956,-0.1875 -0.0257,-0.09191 -0.0257,-0.202206 0,-0.294117 0.20588,-0.5 0.20588,-0.205882 0.5,-0.205882 0.1103,0 0.20221,0.02573 0.0919,0.02573 0.1875,0.09559 0.0956,0.06985 0.1397,0.110294 0.0441,0.04044 0.15809,0.158089 Q 6.15443,5.154409 6.17649,5.176467 6.41914,4.948526 6.41914,4.639703 z M 13,9.823529 q 0,0.882353 -0.625,1.492647 l -1.08088,1.07353 Q 10.68382,13 9.80147,13 q -0.88971,0 -1.5,-0.625 L 6.78676,10.852941 Q 6.17647,10.242647 6.17647,9.360294 q 0,-0.904412 0.64706,-1.536764 L 6.17647,7.176471 Q 5.54412,7.82353 4.64706,7.82353 q -0.88235,0 -1.5,-0.617648 L 1.617647,5.676471 Q 1,5.058824 1,4.176471 1,3.294118 1.625,2.683824 L 2.70588,1.610294 Q 3.31618,1 4.19853,1 q 0.88971,0 1.5,0.625 l 1.51471,1.522059 q 0.61029,0.610294 0.61029,1.492647 0,0.904412 -0.64706,1.536764 L 7.82353,6.823529 Q 8.45588,6.17647 9.35294,6.17647 q 0.88235,0 1.5,0.617648 l 1.52941,1.529411 Q 13,8.941176 13,9.823529 z&quot;/&gt;&lt;/svg&gt;
          &lt;/a&gt;&lt;/h3&gt;

&lt;p&gt;Swift 6.3 introduces new attributes that give library authors finer-grained control over compiler optimizations for clients of their APIs:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;strong&gt;Function specialization:&lt;/strong&gt; Provide pre-specialized implementations of a generic API for common concrete types using &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;@specialize&lt;/code&gt;.&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;Inlining:&lt;/strong&gt; Guarantee inlining — a compiler optimization that expands the body of a function at the call-site — for direct calls to a function with &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;@inline(always)&lt;/code&gt;. Use this attribute only when you’ve determined that the benefits of inlining outweigh any increase in code size.&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;Function implementation visibility:&lt;/strong&gt; Expose the implementation of a function in an ABI-stable library to clients with &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;@export(implementation)&lt;/code&gt;. This allows the function to participate in more compiler optimizations.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For a full list of language evolution proposals in Swift 6.3, see the &lt;a href=&quot;/swift-evolution/#?version=6.3&quot;&gt;Swift Evolution dashboard&lt;/a&gt;.&lt;/p&gt;

&lt;h2 id=&quot;package-and-build-improvements&quot; class=&quot;header-with-anchor&quot;&gt;Package and Build Improvements &lt;a title=&quot;Permalink for Package and Build Improvements section&quot; href=&quot;#package-and-build-improvements&quot;&gt;
            &lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt; &lt;svg width=&quot;18px&quot; height=&quot;18px&quot; viewBox=&quot;0 0 14 14&quot; role=&quot;img&quot; focusable=&quot;false&quot; aria-hidden=&quot;true&quot; xmlns=&quot;http://www.w3.org/2000/svg&quot;&gt;&lt;path d=&quot;m 11.58824,9.823529 q 0,-0.294117 -0.20589,-0.499999 L 9.85294,7.794118 q -0.20588,-0.205883 -0.5,-0.205883 -0.30882,0 -0.52941,0.235295 0.0221,0.02206 0.13971,0.136029 0.11764,0.113971 0.15808,0.158088 0.0404,0.04412 0.1103,0.139706 0.0698,0.09559 0.0956,0.1875 0.0257,0.09191 0.0257,0.202206 0,0.294117 -0.20588,0.5 -0.20588,0.205882 -0.5,0.205882 -0.1103,0 -0.20221,-0.02573 Q 8.35293,9.301471 8.25733,9.231621 8.16173,9.161771 8.11763,9.121327 8.07353,9.080887 7.95954,8.963238 7.84557,8.845591 7.82351,8.823533 7.58086,9.051474 7.58086,9.360297 q 0,0.294118 0.20588,0.5 l 1.51471,1.522059 q 0.19853,0.19853 0.5,0.19853 0.29412,0 0.5,-0.191177 l 1.08088,-1.073529 q 0.20589,-0.205883 0.20589,-0.492648 z M 6.41912,4.639706 q 0,-0.294118 -0.20588,-0.5 L 4.69853,2.617647 q -0.20588,-0.205882 -0.5,-0.205882 -0.28677,0 -0.5,0.198529 L 2.61765,3.683823 q -0.20589,0.205883 -0.20589,0.492648 0,0.294117 0.20589,0.499999 l 1.52941,1.529412 q 0.19853,0.19853 0.5,0.19853 0.30882,0 0.52941,-0.227942 Q 5.15437,6.15441 5.03676,6.040441 4.91912,5.92647 4.87868,5.882353 4.83828,5.838233 4.76838,5.742647 q -0.0698,-0.09559 -0.0956,-0.1875 -0.0257,-0.09191 -0.0257,-0.202206 0,-0.294117 0.20588,-0.5 0.20588,-0.205882 0.5,-0.205882 0.1103,0 0.20221,0.02573 0.0919,0.02573 0.1875,0.09559 0.0956,0.06985 0.1397,0.110294 0.0441,0.04044 0.15809,0.158089 Q 6.15443,5.154409 6.17649,5.176467 6.41914,4.948526 6.41914,4.639703 z M 13,9.823529 q 0,0.882353 -0.625,1.492647 l -1.08088,1.07353 Q 10.68382,13 9.80147,13 q -0.88971,0 -1.5,-0.625 L 6.78676,10.852941 Q 6.17647,10.242647 6.17647,9.360294 q 0,-0.904412 0.64706,-1.536764 L 6.17647,7.176471 Q 5.54412,7.82353 4.64706,7.82353 q -0.88235,0 -1.5,-0.617648 L 1.617647,5.676471 Q 1,5.058824 1,4.176471 1,3.294118 1.625,2.683824 L 2.70588,1.610294 Q 3.31618,1 4.19853,1 q 0.88971,0 1.5,0.625 l 1.51471,1.522059 q 0.61029,0.610294 0.61029,1.492647 0,0.904412 -0.64706,1.536764 L 7.82353,6.823529 Q 8.45588,6.17647 9.35294,6.17647 q 0.88235,0 1.5,0.617648 l 1.52941,1.529411 Q 13,8.941176 13,9.823529 z&quot;/&gt;&lt;/svg&gt;
          &lt;/a&gt;&lt;/h2&gt;

&lt;p&gt;Swift 6.3 includes a preview of &lt;a href=&quot;https://github.com/swiftlang/swift-build&quot;&gt;Swift Build&lt;/a&gt; integrated into Swift Package Manager. This preview brings a unified build engine across all supported platforms for a more consistent cross-platform development experience. To learn more, check out &lt;a href=&quot;https://docs.swift.org/swiftpm/documentation/packagemanagerdocs/swiftbuildpreview&quot;&gt;Preview the Swift Build System Integration&lt;/a&gt;. We encourage you to try it in your own packages and &lt;a href=&quot;https://docs.swift.org/swiftpm/documentation/packagemanagerdocs/swiftbuildpreview/#Reporting-issues&quot;&gt;report any issues&lt;/a&gt; you encounter.&lt;/p&gt;

&lt;p&gt;Swift 6.3 also brings the following Swift Package Manager improvements:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;strong&gt;Prebuilt Swift Syntax for shared macro libraries:&lt;/strong&gt; Factor out shared macro implementation code into a library with support for swift-syntax prebuilt binaries in libraries that are only used by macros.&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;Flexible inherited documentation:&lt;/strong&gt; Control whether inherited documentation is included in command plugins that generate symbol graphs.&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;Discoverable package traits:&lt;/strong&gt; Discover the traits supported by a package using the new &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;swift package show-traits&lt;/code&gt; command.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For more information on changes to Swift Package Manager, see the &lt;a href=&quot;https://docs.swift.org/swiftpm/documentation/packagemanagerdocs/6.3&quot;&gt;SwiftPM 6.3 Release Notes&lt;/a&gt;.&lt;/p&gt;

&lt;h2 id=&quot;core-library-updates&quot; class=&quot;header-with-anchor&quot;&gt;Core Library Updates &lt;a title=&quot;Permalink for Core Library Updates section&quot; href=&quot;#core-library-updates&quot;&gt;
            &lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt; &lt;svg width=&quot;18px&quot; height=&quot;18px&quot; viewBox=&quot;0 0 14 14&quot; role=&quot;img&quot; focusable=&quot;false&quot; aria-hidden=&quot;true&quot; xmlns=&quot;http://www.w3.org/2000/svg&quot;&gt;&lt;path d=&quot;m 11.58824,9.823529 q 0,-0.294117 -0.20589,-0.499999 L 9.85294,7.794118 q -0.20588,-0.205883 -0.5,-0.205883 -0.30882,0 -0.52941,0.235295 0.0221,0.02206 0.13971,0.136029 0.11764,0.113971 0.15808,0.158088 0.0404,0.04412 0.1103,0.139706 0.0698,0.09559 0.0956,0.1875 0.0257,0.09191 0.0257,0.202206 0,0.294117 -0.20588,0.5 -0.20588,0.205882 -0.5,0.205882 -0.1103,0 -0.20221,-0.02573 Q 8.35293,9.301471 8.25733,9.231621 8.16173,9.161771 8.11763,9.121327 8.07353,9.080887 7.95954,8.963238 7.84557,8.845591 7.82351,8.823533 7.58086,9.051474 7.58086,9.360297 q 0,0.294118 0.20588,0.5 l 1.51471,1.522059 q 0.19853,0.19853 0.5,0.19853 0.29412,0 0.5,-0.191177 l 1.08088,-1.073529 q 0.20589,-0.205883 0.20589,-0.492648 z M 6.41912,4.639706 q 0,-0.294118 -0.20588,-0.5 L 4.69853,2.617647 q -0.20588,-0.205882 -0.5,-0.205882 -0.28677,0 -0.5,0.198529 L 2.61765,3.683823 q -0.20589,0.205883 -0.20589,0.492648 0,0.294117 0.20589,0.499999 l 1.52941,1.529412 q 0.19853,0.19853 0.5,0.19853 0.30882,0 0.52941,-0.227942 Q 5.15437,6.15441 5.03676,6.040441 4.91912,5.92647 4.87868,5.882353 4.83828,5.838233 4.76838,5.742647 q -0.0698,-0.09559 -0.0956,-0.1875 -0.0257,-0.09191 -0.0257,-0.202206 0,-0.294117 0.20588,-0.5 0.20588,-0.205882 0.5,-0.205882 0.1103,0 0.20221,0.02573 0.0919,0.02573 0.1875,0.09559 0.0956,0.06985 0.1397,0.110294 0.0441,0.04044 0.15809,0.158089 Q 6.15443,5.154409 6.17649,5.176467 6.41914,4.948526 6.41914,4.639703 z M 13,9.823529 q 0,0.882353 -0.625,1.492647 l -1.08088,1.07353 Q 10.68382,13 9.80147,13 q -0.88971,0 -1.5,-0.625 L 6.78676,10.852941 Q 6.17647,10.242647 6.17647,9.360294 q 0,-0.904412 0.64706,-1.536764 L 6.17647,7.176471 Q 5.54412,7.82353 4.64706,7.82353 q -0.88235,0 -1.5,-0.617648 L 1.617647,5.676471 Q 1,5.058824 1,4.176471 1,3.294118 1.625,2.683824 L 2.70588,1.610294 Q 3.31618,1 4.19853,1 q 0.88971,0 1.5,0.625 l 1.51471,1.522059 q 0.61029,0.610294 0.61029,1.492647 0,0.904412 -0.64706,1.536764 L 7.82353,6.823529 Q 8.45588,6.17647 9.35294,6.17647 q 0.88235,0 1.5,0.617648 l 1.52941,1.529411 Q 13,8.941176 13,9.823529 z&quot;/&gt;&lt;/svg&gt;
          &lt;/a&gt;&lt;/h2&gt;

&lt;h3 id=&quot;swift-testing&quot; class=&quot;header-with-anchor&quot;&gt;Swift Testing &lt;a title=&quot;Permalink for Swift Testing section&quot; href=&quot;#swift-testing&quot;&gt;
            &lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt; &lt;svg width=&quot;18px&quot; height=&quot;18px&quot; viewBox=&quot;0 0 14 14&quot; role=&quot;img&quot; focusable=&quot;false&quot; aria-hidden=&quot;true&quot; xmlns=&quot;http://www.w3.org/2000/svg&quot;&gt;&lt;path d=&quot;m 11.58824,9.823529 q 0,-0.294117 -0.20589,-0.499999 L 9.85294,7.794118 q -0.20588,-0.205883 -0.5,-0.205883 -0.30882,0 -0.52941,0.235295 0.0221,0.02206 0.13971,0.136029 0.11764,0.113971 0.15808,0.158088 0.0404,0.04412 0.1103,0.139706 0.0698,0.09559 0.0956,0.1875 0.0257,0.09191 0.0257,0.202206 0,0.294117 -0.20588,0.5 -0.20588,0.205882 -0.5,0.205882 -0.1103,0 -0.20221,-0.02573 Q 8.35293,9.301471 8.25733,9.231621 8.16173,9.161771 8.11763,9.121327 8.07353,9.080887 7.95954,8.963238 7.84557,8.845591 7.82351,8.823533 7.58086,9.051474 7.58086,9.360297 q 0,0.294118 0.20588,0.5 l 1.51471,1.522059 q 0.19853,0.19853 0.5,0.19853 0.29412,0 0.5,-0.191177 l 1.08088,-1.073529 q 0.20589,-0.205883 0.20589,-0.492648 z M 6.41912,4.639706 q 0,-0.294118 -0.20588,-0.5 L 4.69853,2.617647 q -0.20588,-0.205882 -0.5,-0.205882 -0.28677,0 -0.5,0.198529 L 2.61765,3.683823 q -0.20589,0.205883 -0.20589,0.492648 0,0.294117 0.20589,0.499999 l 1.52941,1.529412 q 0.19853,0.19853 0.5,0.19853 0.30882,0 0.52941,-0.227942 Q 5.15437,6.15441 5.03676,6.040441 4.91912,5.92647 4.87868,5.882353 4.83828,5.838233 4.76838,5.742647 q -0.0698,-0.09559 -0.0956,-0.1875 -0.0257,-0.09191 -0.0257,-0.202206 0,-0.294117 0.20588,-0.5 0.20588,-0.205882 0.5,-0.205882 0.1103,0 0.20221,0.02573 0.0919,0.02573 0.1875,0.09559 0.0956,0.06985 0.1397,0.110294 0.0441,0.04044 0.15809,0.158089 Q 6.15443,5.154409 6.17649,5.176467 6.41914,4.948526 6.41914,4.639703 z M 13,9.823529 q 0,0.882353 -0.625,1.492647 l -1.08088,1.07353 Q 10.68382,13 9.80147,13 q -0.88971,0 -1.5,-0.625 L 6.78676,10.852941 Q 6.17647,10.242647 6.17647,9.360294 q 0,-0.904412 0.64706,-1.536764 L 6.17647,7.176471 Q 5.54412,7.82353 4.64706,7.82353 q -0.88235,0 -1.5,-0.617648 L 1.617647,5.676471 Q 1,5.058824 1,4.176471 1,3.294118 1.625,2.683824 L 2.70588,1.610294 Q 3.31618,1 4.19853,1 q 0.88971,0 1.5,0.625 l 1.51471,1.522059 q 0.61029,0.610294 0.61029,1.492647 0,0.904412 -0.64706,1.536764 L 7.82353,6.823529 Q 8.45588,6.17647 9.35294,6.17647 q 0.88235,0 1.5,0.617648 l 1.52941,1.529411 Q 13,8.941176 13,9.823529 z&quot;/&gt;&lt;/svg&gt;
          &lt;/a&gt;&lt;/h3&gt;

&lt;p&gt;Swift Testing has a number of improvements, including warning issues, test cancellation, and image attachments.&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;strong&gt;Warning issues&lt;/strong&gt;: Specify the severity of a test issue using the new &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;severity&lt;/code&gt; parameter to &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Issue.record&lt;/code&gt;. You can record an issue as a warning using &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Issue.record(&quot;Something suspicious happened&quot;, severity: .warning)&lt;/code&gt;. This is reflected in the test’s results, but doesn’t mark the test as a failure.&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;Test cancellation&lt;/strong&gt;: Cancel a test (and its task hierarchy) after it starts using &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;try Test.cancel()&lt;/code&gt;. This is helpful for skipping individual arguments of a parameterized test, or responding to conditions during a test that indicate it shouldn’t proceed.&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;Image attachments&lt;/strong&gt;: Attach common image types during a test on Apple and Windows platforms. This is exposed via several new cross-import overlay modules with UI frameworks like UIKit.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The list of Swift Testing evolution proposals included in Swift 6.3 are &lt;a href=&quot;https://github.com/swiftlang/swift-evolution/blob/main/proposals/testing/0012-exit-test-value-capturing.md&quot;&gt;ST-0012&lt;/a&gt;, &lt;a href=&quot;https://github.com/swiftlang/swift-evolution/blob/main/proposals/testing/0013-issue-severity-warning.md&quot;&gt;ST-0013&lt;/a&gt;, &lt;a href=&quot;https://github.com/swiftlang/swift-evolution/blob/main/proposals/testing/0014-image-attachments-in-swift-testing-apple-platforms.md&quot;&gt;ST-0014&lt;/a&gt;, &lt;a href=&quot;https://github.com/swiftlang/swift-evolution/blob/main/proposals/testing/0015-image-attachments-in-swift-testing-windows.md&quot;&gt;ST-0015&lt;/a&gt;, &lt;a href=&quot;https://github.com/swiftlang/swift-evolution/blob/main/proposals/testing/0016-test-cancellation.md&quot;&gt;ST-0016&lt;/a&gt;, &lt;a href=&quot;https://github.com/swiftlang/swift-evolution/blob/main/proposals/testing/0017-image-attachment-consolidation.md&quot;&gt;ST-0017&lt;/a&gt;, and &lt;a href=&quot;https://github.com/swiftlang/swift-evolution/blob/main/proposals/testing/0020-sourcelocation-filepath.md&quot;&gt;ST-0020&lt;/a&gt;.&lt;/p&gt;

&lt;h3 id=&quot;docc&quot; class=&quot;header-with-anchor&quot;&gt;DocC &lt;a title=&quot;Permalink for DocC section&quot; href=&quot;#docc&quot;&gt;
            &lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt; &lt;svg width=&quot;18px&quot; height=&quot;18px&quot; viewBox=&quot;0 0 14 14&quot; role=&quot;img&quot; focusable=&quot;false&quot; aria-hidden=&quot;true&quot; xmlns=&quot;http://www.w3.org/2000/svg&quot;&gt;&lt;path d=&quot;m 11.58824,9.823529 q 0,-0.294117 -0.20589,-0.499999 L 9.85294,7.794118 q -0.20588,-0.205883 -0.5,-0.205883 -0.30882,0 -0.52941,0.235295 0.0221,0.02206 0.13971,0.136029 0.11764,0.113971 0.15808,0.158088 0.0404,0.04412 0.1103,0.139706 0.0698,0.09559 0.0956,0.1875 0.0257,0.09191 0.0257,0.202206 0,0.294117 -0.20588,0.5 -0.20588,0.205882 -0.5,0.205882 -0.1103,0 -0.20221,-0.02573 Q 8.35293,9.301471 8.25733,9.231621 8.16173,9.161771 8.11763,9.121327 8.07353,9.080887 7.95954,8.963238 7.84557,8.845591 7.82351,8.823533 7.58086,9.051474 7.58086,9.360297 q 0,0.294118 0.20588,0.5 l 1.51471,1.522059 q 0.19853,0.19853 0.5,0.19853 0.29412,0 0.5,-0.191177 l 1.08088,-1.073529 q 0.20589,-0.205883 0.20589,-0.492648 z M 6.41912,4.639706 q 0,-0.294118 -0.20588,-0.5 L 4.69853,2.617647 q -0.20588,-0.205882 -0.5,-0.205882 -0.28677,0 -0.5,0.198529 L 2.61765,3.683823 q -0.20589,0.205883 -0.20589,0.492648 0,0.294117 0.20589,0.499999 l 1.52941,1.529412 q 0.19853,0.19853 0.5,0.19853 0.30882,0 0.52941,-0.227942 Q 5.15437,6.15441 5.03676,6.040441 4.91912,5.92647 4.87868,5.882353 4.83828,5.838233 4.76838,5.742647 q -0.0698,-0.09559 -0.0956,-0.1875 -0.0257,-0.09191 -0.0257,-0.202206 0,-0.294117 0.20588,-0.5 0.20588,-0.205882 0.5,-0.205882 0.1103,0 0.20221,0.02573 0.0919,0.02573 0.1875,0.09559 0.0956,0.06985 0.1397,0.110294 0.0441,0.04044 0.15809,0.158089 Q 6.15443,5.154409 6.17649,5.176467 6.41914,4.948526 6.41914,4.639703 z M 13,9.823529 q 0,0.882353 -0.625,1.492647 l -1.08088,1.07353 Q 10.68382,13 9.80147,13 q -0.88971,0 -1.5,-0.625 L 6.78676,10.852941 Q 6.17647,10.242647 6.17647,9.360294 q 0,-0.904412 0.64706,-1.536764 L 6.17647,7.176471 Q 5.54412,7.82353 4.64706,7.82353 q -0.88235,0 -1.5,-0.617648 L 1.617647,5.676471 Q 1,5.058824 1,4.176471 1,3.294118 1.625,2.683824 L 2.70588,1.610294 Q 3.31618,1 4.19853,1 q 0.88971,0 1.5,0.625 l 1.51471,1.522059 q 0.61029,0.610294 0.61029,1.492647 0,0.904412 -0.64706,1.536764 L 7.82353,6.823529 Q 8.45588,6.17647 9.35294,6.17647 q 0.88235,0 1.5,0.617648 l 1.52941,1.529411 Q 13,8.941176 13,9.823529 z&quot;/&gt;&lt;/svg&gt;
          &lt;/a&gt;&lt;/h3&gt;

&lt;p&gt;Swift 6.3 adds three new experimental capabilities to DocC:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;strong&gt;Markdown output:&lt;/strong&gt; Generate Markdown versions of your documentation pages alongside the standard rendered JSON covering symbols, articles, and tutorials. Try it out by passing &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;--enable-experimental-markdown-output&lt;/code&gt; to &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;docc convert&lt;/code&gt;.&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;Per-page static HTML content:&lt;/strong&gt; Embed a lightweight HTML summary of each page — including title, description, availability, declarations, and discussion — directly into the index.html file within a &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;&amp;lt;noscript&amp;gt;&lt;/code&gt; tag. This improves discoverability by search engines and accessibility for screen readers without requiring JavaScript. Try it out by passing &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;--transform-for-static-hosting --experimental-transform-for-static-hosting-with-content&lt;/code&gt; to &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;docc convert&lt;/code&gt;.&lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;&lt;strong&gt;Code block annotations:&lt;/strong&gt; Unlock new formatting annotations for code blocks, including &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;nocopy&lt;/code&gt; for disabling copy-to-clipboard, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;highlight&lt;/code&gt; to highlight specific lines by number, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;showLineNumbers&lt;/code&gt; to display line numbers, and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;wrap&lt;/code&gt; to wrap long lines by column width. Specify these options in a comma-separated list after the language name on the opening fence line:&lt;/p&gt;

    &lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;```swift, nocopy
let config = loadDefaultConfig()
```
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;    &lt;/div&gt;

    &lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt; ```swift, highlight=[1, 3]
let name = &quot;World&quot;       // highlighted
let greeting = &quot;Hello&quot;
print(&quot;\(greeting), \(name)!&quot;)  // highlighted
```
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;    &lt;/div&gt;

    &lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;```swift, showLineNumbers, wrap=80
func example() { /* ... */ }
```
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;    &lt;/div&gt;

    &lt;p&gt;DocC validates line indices and warns about unrecognized options. Try out the new code block annotations with &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;--enable-experimental-code-block-annotations&lt;/code&gt;.&lt;/p&gt;
  &lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;platforms-and-environments&quot; class=&quot;header-with-anchor&quot;&gt;Platforms and Environments &lt;a title=&quot;Permalink for Platforms and Environments section&quot; href=&quot;#platforms-and-environments&quot;&gt;
            &lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt; &lt;svg width=&quot;18px&quot; height=&quot;18px&quot; viewBox=&quot;0 0 14 14&quot; role=&quot;img&quot; focusable=&quot;false&quot; aria-hidden=&quot;true&quot; xmlns=&quot;http://www.w3.org/2000/svg&quot;&gt;&lt;path d=&quot;m 11.58824,9.823529 q 0,-0.294117 -0.20589,-0.499999 L 9.85294,7.794118 q -0.20588,-0.205883 -0.5,-0.205883 -0.30882,0 -0.52941,0.235295 0.0221,0.02206 0.13971,0.136029 0.11764,0.113971 0.15808,0.158088 0.0404,0.04412 0.1103,0.139706 0.0698,0.09559 0.0956,0.1875 0.0257,0.09191 0.0257,0.202206 0,0.294117 -0.20588,0.5 -0.20588,0.205882 -0.5,0.205882 -0.1103,0 -0.20221,-0.02573 Q 8.35293,9.301471 8.25733,9.231621 8.16173,9.161771 8.11763,9.121327 8.07353,9.080887 7.95954,8.963238 7.84557,8.845591 7.82351,8.823533 7.58086,9.051474 7.58086,9.360297 q 0,0.294118 0.20588,0.5 l 1.51471,1.522059 q 0.19853,0.19853 0.5,0.19853 0.29412,0 0.5,-0.191177 l 1.08088,-1.073529 q 0.20589,-0.205883 0.20589,-0.492648 z M 6.41912,4.639706 q 0,-0.294118 -0.20588,-0.5 L 4.69853,2.617647 q -0.20588,-0.205882 -0.5,-0.205882 -0.28677,0 -0.5,0.198529 L 2.61765,3.683823 q -0.20589,0.205883 -0.20589,0.492648 0,0.294117 0.20589,0.499999 l 1.52941,1.529412 q 0.19853,0.19853 0.5,0.19853 0.30882,0 0.52941,-0.227942 Q 5.15437,6.15441 5.03676,6.040441 4.91912,5.92647 4.87868,5.882353 4.83828,5.838233 4.76838,5.742647 q -0.0698,-0.09559 -0.0956,-0.1875 -0.0257,-0.09191 -0.0257,-0.202206 0,-0.294117 0.20588,-0.5 0.20588,-0.205882 0.5,-0.205882 0.1103,0 0.20221,0.02573 0.0919,0.02573 0.1875,0.09559 0.0956,0.06985 0.1397,0.110294 0.0441,0.04044 0.15809,0.158089 Q 6.15443,5.154409 6.17649,5.176467 6.41914,4.948526 6.41914,4.639703 z M 13,9.823529 q 0,0.882353 -0.625,1.492647 l -1.08088,1.07353 Q 10.68382,13 9.80147,13 q -0.88971,0 -1.5,-0.625 L 6.78676,10.852941 Q 6.17647,10.242647 6.17647,9.360294 q 0,-0.904412 0.64706,-1.536764 L 6.17647,7.176471 Q 5.54412,7.82353 4.64706,7.82353 q -0.88235,0 -1.5,-0.617648 L 1.617647,5.676471 Q 1,5.058824 1,4.176471 1,3.294118 1.625,2.683824 L 2.70588,1.610294 Q 3.31618,1 4.19853,1 q 0.88971,0 1.5,0.625 l 1.51471,1.522059 q 0.61029,0.610294 0.61029,1.492647 0,0.904412 -0.64706,1.536764 L 7.82353,6.823529 Q 8.45588,6.17647 9.35294,6.17647 q 0.88235,0 1.5,0.617648 l 1.52941,1.529411 Q 13,8.941176 13,9.823529 z&quot;/&gt;&lt;/svg&gt;
          &lt;/a&gt;&lt;/h2&gt;

&lt;h3 id=&quot;embedded-swift&quot; class=&quot;header-with-anchor&quot;&gt;Embedded Swift &lt;a title=&quot;Permalink for Embedded Swift section&quot; href=&quot;#embedded-swift&quot;&gt;
            &lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt; &lt;svg width=&quot;18px&quot; height=&quot;18px&quot; viewBox=&quot;0 0 14 14&quot; role=&quot;img&quot; focusable=&quot;false&quot; aria-hidden=&quot;true&quot; xmlns=&quot;http://www.w3.org/2000/svg&quot;&gt;&lt;path d=&quot;m 11.58824,9.823529 q 0,-0.294117 -0.20589,-0.499999 L 9.85294,7.794118 q -0.20588,-0.205883 -0.5,-0.205883 -0.30882,0 -0.52941,0.235295 0.0221,0.02206 0.13971,0.136029 0.11764,0.113971 0.15808,0.158088 0.0404,0.04412 0.1103,0.139706 0.0698,0.09559 0.0956,0.1875 0.0257,0.09191 0.0257,0.202206 0,0.294117 -0.20588,0.5 -0.20588,0.205882 -0.5,0.205882 -0.1103,0 -0.20221,-0.02573 Q 8.35293,9.301471 8.25733,9.231621 8.16173,9.161771 8.11763,9.121327 8.07353,9.080887 7.95954,8.963238 7.84557,8.845591 7.82351,8.823533 7.58086,9.051474 7.58086,9.360297 q 0,0.294118 0.20588,0.5 l 1.51471,1.522059 q 0.19853,0.19853 0.5,0.19853 0.29412,0 0.5,-0.191177 l 1.08088,-1.073529 q 0.20589,-0.205883 0.20589,-0.492648 z M 6.41912,4.639706 q 0,-0.294118 -0.20588,-0.5 L 4.69853,2.617647 q -0.20588,-0.205882 -0.5,-0.205882 -0.28677,0 -0.5,0.198529 L 2.61765,3.683823 q -0.20589,0.205883 -0.20589,0.492648 0,0.294117 0.20589,0.499999 l 1.52941,1.529412 q 0.19853,0.19853 0.5,0.19853 0.30882,0 0.52941,-0.227942 Q 5.15437,6.15441 5.03676,6.040441 4.91912,5.92647 4.87868,5.882353 4.83828,5.838233 4.76838,5.742647 q -0.0698,-0.09559 -0.0956,-0.1875 -0.0257,-0.09191 -0.0257,-0.202206 0,-0.294117 0.20588,-0.5 0.20588,-0.205882 0.5,-0.205882 0.1103,0 0.20221,0.02573 0.0919,0.02573 0.1875,0.09559 0.0956,0.06985 0.1397,0.110294 0.0441,0.04044 0.15809,0.158089 Q 6.15443,5.154409 6.17649,5.176467 6.41914,4.948526 6.41914,4.639703 z M 13,9.823529 q 0,0.882353 -0.625,1.492647 l -1.08088,1.07353 Q 10.68382,13 9.80147,13 q -0.88971,0 -1.5,-0.625 L 6.78676,10.852941 Q 6.17647,10.242647 6.17647,9.360294 q 0,-0.904412 0.64706,-1.536764 L 6.17647,7.176471 Q 5.54412,7.82353 4.64706,7.82353 q -0.88235,0 -1.5,-0.617648 L 1.617647,5.676471 Q 1,5.058824 1,4.176471 1,3.294118 1.625,2.683824 L 2.70588,1.610294 Q 3.31618,1 4.19853,1 q 0.88971,0 1.5,0.625 l 1.51471,1.522059 q 0.61029,0.610294 0.61029,1.492647 0,0.904412 -0.64706,1.536764 L 7.82353,6.823529 Q 8.45588,6.17647 9.35294,6.17647 q 0.88235,0 1.5,0.617648 l 1.52941,1.529411 Q 13,8.941176 13,9.823529 z&quot;/&gt;&lt;/svg&gt;
          &lt;/a&gt;&lt;/h3&gt;

&lt;p&gt;Embedded Swift has a wide range of improvements in Swift 6.3, from enhanced C interoperability and better debugging support to meaningful steps toward a complete linkage model. For a detailed look at what’s new in embedded Swift, see &lt;a href=&quot;/blog/embedded-swift-improvements-coming-in-swift-6.3/&quot;&gt;Embedded Swift Improvements coming in Swift 6.3&lt;/a&gt;.&lt;/p&gt;

&lt;h3 id=&quot;android&quot; class=&quot;header-with-anchor&quot;&gt;Android &lt;a title=&quot;Permalink for Android section&quot; href=&quot;#android&quot;&gt;
            &lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt; &lt;svg width=&quot;18px&quot; height=&quot;18px&quot; viewBox=&quot;0 0 14 14&quot; role=&quot;img&quot; focusable=&quot;false&quot; aria-hidden=&quot;true&quot; xmlns=&quot;http://www.w3.org/2000/svg&quot;&gt;&lt;path d=&quot;m 11.58824,9.823529 q 0,-0.294117 -0.20589,-0.499999 L 9.85294,7.794118 q -0.20588,-0.205883 -0.5,-0.205883 -0.30882,0 -0.52941,0.235295 0.0221,0.02206 0.13971,0.136029 0.11764,0.113971 0.15808,0.158088 0.0404,0.04412 0.1103,0.139706 0.0698,0.09559 0.0956,0.1875 0.0257,0.09191 0.0257,0.202206 0,0.294117 -0.20588,0.5 -0.20588,0.205882 -0.5,0.205882 -0.1103,0 -0.20221,-0.02573 Q 8.35293,9.301471 8.25733,9.231621 8.16173,9.161771 8.11763,9.121327 8.07353,9.080887 7.95954,8.963238 7.84557,8.845591 7.82351,8.823533 7.58086,9.051474 7.58086,9.360297 q 0,0.294118 0.20588,0.5 l 1.51471,1.522059 q 0.19853,0.19853 0.5,0.19853 0.29412,0 0.5,-0.191177 l 1.08088,-1.073529 q 0.20589,-0.205883 0.20589,-0.492648 z M 6.41912,4.639706 q 0,-0.294118 -0.20588,-0.5 L 4.69853,2.617647 q -0.20588,-0.205882 -0.5,-0.205882 -0.28677,0 -0.5,0.198529 L 2.61765,3.683823 q -0.20589,0.205883 -0.20589,0.492648 0,0.294117 0.20589,0.499999 l 1.52941,1.529412 q 0.19853,0.19853 0.5,0.19853 0.30882,0 0.52941,-0.227942 Q 5.15437,6.15441 5.03676,6.040441 4.91912,5.92647 4.87868,5.882353 4.83828,5.838233 4.76838,5.742647 q -0.0698,-0.09559 -0.0956,-0.1875 -0.0257,-0.09191 -0.0257,-0.202206 0,-0.294117 0.20588,-0.5 0.20588,-0.205882 0.5,-0.205882 0.1103,0 0.20221,0.02573 0.0919,0.02573 0.1875,0.09559 0.0956,0.06985 0.1397,0.110294 0.0441,0.04044 0.15809,0.158089 Q 6.15443,5.154409 6.17649,5.176467 6.41914,4.948526 6.41914,4.639703 z M 13,9.823529 q 0,0.882353 -0.625,1.492647 l -1.08088,1.07353 Q 10.68382,13 9.80147,13 q -0.88971,0 -1.5,-0.625 L 6.78676,10.852941 Q 6.17647,10.242647 6.17647,9.360294 q 0,-0.904412 0.64706,-1.536764 L 6.17647,7.176471 Q 5.54412,7.82353 4.64706,7.82353 q -0.88235,0 -1.5,-0.617648 L 1.617647,5.676471 Q 1,5.058824 1,4.176471 1,3.294118 1.625,2.683824 L 2.70588,1.610294 Q 3.31618,1 4.19853,1 q 0.88971,0 1.5,0.625 l 1.51471,1.522059 q 0.61029,0.610294 0.61029,1.492647 0,0.904412 -0.64706,1.536764 L 7.82353,6.823529 Q 8.45588,6.17647 9.35294,6.17647 q 0.88235,0 1.5,0.617648 l 1.52941,1.529411 Q 13,8.941176 13,9.823529 z&quot;/&gt;&lt;/svg&gt;
          &lt;/a&gt;&lt;/h3&gt;

&lt;p&gt;Swift 6.3 includes the first official release of the Swift SDK for Android. With this SDK, you can start developing native Android programs in Swift, update your Swift packages to support building for Android, and use &lt;a href=&quot;https://github.com/swiftlang/swift-java&quot;&gt;Swift Java&lt;/a&gt; and &lt;a href=&quot;https://github.com/swiftlang/swift-java-jni-core&quot;&gt;Swift Java JNI Core&lt;/a&gt; to integrate Swift code into existing Android applications written in Kotlin/Java. This is a significant milestone that opens new opportunities for cross-platform development in Swift.&lt;/p&gt;

&lt;p&gt;To learn more and try out Swift for Android development in your own projects, see &lt;a href=&quot;/documentation/articles/swift-sdk-for-android-getting-started.html&quot;&gt;Getting Started with the Swift SDK for Android&lt;/a&gt;.&lt;/p&gt;

&lt;h2 id=&quot;thank-you&quot; class=&quot;header-with-anchor&quot;&gt;Thank You &lt;a title=&quot;Permalink for Thank You section&quot; href=&quot;#thank-you&quot;&gt;
            &lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt; &lt;svg width=&quot;18px&quot; height=&quot;18px&quot; viewBox=&quot;0 0 14 14&quot; role=&quot;img&quot; focusable=&quot;false&quot; aria-hidden=&quot;true&quot; xmlns=&quot;http://www.w3.org/2000/svg&quot;&gt;&lt;path d=&quot;m 11.58824,9.823529 q 0,-0.294117 -0.20589,-0.499999 L 9.85294,7.794118 q -0.20588,-0.205883 -0.5,-0.205883 -0.30882,0 -0.52941,0.235295 0.0221,0.02206 0.13971,0.136029 0.11764,0.113971 0.15808,0.158088 0.0404,0.04412 0.1103,0.139706 0.0698,0.09559 0.0956,0.1875 0.0257,0.09191 0.0257,0.202206 0,0.294117 -0.20588,0.5 -0.20588,0.205882 -0.5,0.205882 -0.1103,0 -0.20221,-0.02573 Q 8.35293,9.301471 8.25733,9.231621 8.16173,9.161771 8.11763,9.121327 8.07353,9.080887 7.95954,8.963238 7.84557,8.845591 7.82351,8.823533 7.58086,9.051474 7.58086,9.360297 q 0,0.294118 0.20588,0.5 l 1.51471,1.522059 q 0.19853,0.19853 0.5,0.19853 0.29412,0 0.5,-0.191177 l 1.08088,-1.073529 q 0.20589,-0.205883 0.20589,-0.492648 z M 6.41912,4.639706 q 0,-0.294118 -0.20588,-0.5 L 4.69853,2.617647 q -0.20588,-0.205882 -0.5,-0.205882 -0.28677,0 -0.5,0.198529 L 2.61765,3.683823 q -0.20589,0.205883 -0.20589,0.492648 0,0.294117 0.20589,0.499999 l 1.52941,1.529412 q 0.19853,0.19853 0.5,0.19853 0.30882,0 0.52941,-0.227942 Q 5.15437,6.15441 5.03676,6.040441 4.91912,5.92647 4.87868,5.882353 4.83828,5.838233 4.76838,5.742647 q -0.0698,-0.09559 -0.0956,-0.1875 -0.0257,-0.09191 -0.0257,-0.202206 0,-0.294117 0.20588,-0.5 0.20588,-0.205882 0.5,-0.205882 0.1103,0 0.20221,0.02573 0.0919,0.02573 0.1875,0.09559 0.0956,0.06985 0.1397,0.110294 0.0441,0.04044 0.15809,0.158089 Q 6.15443,5.154409 6.17649,5.176467 6.41914,4.948526 6.41914,4.639703 z M 13,9.823529 q 0,0.882353 -0.625,1.492647 l -1.08088,1.07353 Q 10.68382,13 9.80147,13 q -0.88971,0 -1.5,-0.625 L 6.78676,10.852941 Q 6.17647,10.242647 6.17647,9.360294 q 0,-0.904412 0.64706,-1.536764 L 6.17647,7.176471 Q 5.54412,7.82353 4.64706,7.82353 q -0.88235,0 -1.5,-0.617648 L 1.617647,5.676471 Q 1,5.058824 1,4.176471 1,3.294118 1.625,2.683824 L 2.70588,1.610294 Q 3.31618,1 4.19853,1 q 0.88971,0 1.5,0.625 l 1.51471,1.522059 q 0.61029,0.610294 0.61029,1.492647 0,0.904412 -0.64706,1.536764 L 7.82353,6.823529 Q 8.45588,6.17647 9.35294,6.17647 q 0.88235,0 1.5,0.617648 l 1.52941,1.529411 Q 13,8.941176 13,9.823529 z&quot;/&gt;&lt;/svg&gt;
          &lt;/a&gt;&lt;/h2&gt;

&lt;p&gt;Swift 6.3 reflects the contributions of many people across the Swift community — through code, proposals, forum discussions, and feedback from real-world experience. A special thank you to the Android Workgroup, whose months of effort — building on many years of grassroots community work — brought the Swift SDK for Android from nightly previews to an official release in Swift 6.3.&lt;/p&gt;

&lt;p&gt;If you’d like to get involved in what comes next, the &lt;a href=&quot;http://forums.swift.org/&quot;&gt;Swift Forums&lt;/a&gt; are a great place to start.&lt;/p&gt;

&lt;h2 id=&quot;next-steps&quot; class=&quot;header-with-anchor&quot;&gt;Next Steps &lt;a title=&quot;Permalink for Next Steps section&quot; href=&quot;#next-steps&quot;&gt;
            &lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt; &lt;svg width=&quot;18px&quot; height=&quot;18px&quot; viewBox=&quot;0 0 14 14&quot; role=&quot;img&quot; focusable=&quot;false&quot; aria-hidden=&quot;true&quot; xmlns=&quot;http://www.w3.org/2000/svg&quot;&gt;&lt;path d=&quot;m 11.58824,9.823529 q 0,-0.294117 -0.20589,-0.499999 L 9.85294,7.794118 q -0.20588,-0.205883 -0.5,-0.205883 -0.30882,0 -0.52941,0.235295 0.0221,0.02206 0.13971,0.136029 0.11764,0.113971 0.15808,0.158088 0.0404,0.04412 0.1103,0.139706 0.0698,0.09559 0.0956,0.1875 0.0257,0.09191 0.0257,0.202206 0,0.294117 -0.20588,0.5 -0.20588,0.205882 -0.5,0.205882 -0.1103,0 -0.20221,-0.02573 Q 8.35293,9.301471 8.25733,9.231621 8.16173,9.161771 8.11763,9.121327 8.07353,9.080887 7.95954,8.963238 7.84557,8.845591 7.82351,8.823533 7.58086,9.051474 7.58086,9.360297 q 0,0.294118 0.20588,0.5 l 1.51471,1.522059 q 0.19853,0.19853 0.5,0.19853 0.29412,0 0.5,-0.191177 l 1.08088,-1.073529 q 0.20589,-0.205883 0.20589,-0.492648 z M 6.41912,4.639706 q 0,-0.294118 -0.20588,-0.5 L 4.69853,2.617647 q -0.20588,-0.205882 -0.5,-0.205882 -0.28677,0 -0.5,0.198529 L 2.61765,3.683823 q -0.20589,0.205883 -0.20589,0.492648 0,0.294117 0.20589,0.499999 l 1.52941,1.529412 q 0.19853,0.19853 0.5,0.19853 0.30882,0 0.52941,-0.227942 Q 5.15437,6.15441 5.03676,6.040441 4.91912,5.92647 4.87868,5.882353 4.83828,5.838233 4.76838,5.742647 q -0.0698,-0.09559 -0.0956,-0.1875 -0.0257,-0.09191 -0.0257,-0.202206 0,-0.294117 0.20588,-0.5 0.20588,-0.205882 0.5,-0.205882 0.1103,0 0.20221,0.02573 0.0919,0.02573 0.1875,0.09559 0.0956,0.06985 0.1397,0.110294 0.0441,0.04044 0.15809,0.158089 Q 6.15443,5.154409 6.17649,5.176467 6.41914,4.948526 6.41914,4.639703 z M 13,9.823529 q 0,0.882353 -0.625,1.492647 l -1.08088,1.07353 Q 10.68382,13 9.80147,13 q -0.88971,0 -1.5,-0.625 L 6.78676,10.852941 Q 6.17647,10.242647 6.17647,9.360294 q 0,-0.904412 0.64706,-1.536764 L 6.17647,7.176471 Q 5.54412,7.82353 4.64706,7.82353 q -0.88235,0 -1.5,-0.617648 L 1.617647,5.676471 Q 1,5.058824 1,4.176471 1,3.294118 1.625,2.683824 L 2.70588,1.610294 Q 3.31618,1 4.19853,1 q 0.88971,0 1.5,0.625 l 1.51471,1.522059 q 0.61029,0.610294 0.61029,1.492647 0,0.904412 -0.64706,1.536764 L 7.82353,6.823529 Q 8.45588,6.17647 9.35294,6.17647 q 0.88235,0 1.5,0.617648 l 1.52941,1.529411 Q 13,8.941176 13,9.823529 z&quot;/&gt;&lt;/svg&gt;
          &lt;/a&gt;&lt;/h2&gt;

&lt;p&gt;Try out Swift 6.3 today! You can find instructions for installing a Swift 6.3 toolchain on the &lt;a href=&quot;/install/&quot;&gt;Install Swift&lt;/a&gt; page.&lt;/p&gt;
</content>
  </entry>
  
  <entry>
    <title>Swift at scale: building the TelemetryDeck analytics service</title>
    
      
        
        <author>
        
          <name>Daniel Jilg</name>
        
        </author>
      
    
    <link href="https://swift.org/blog/building-privacy-first-analytics-with-swift/"/>
    <updated>2026-03-06T07:00:00-04:00</updated>
    <id>https://swift.org/blog/building-privacy-first-analytics-with-swift/</id>
    <content type="html">&lt;p&gt;TelemetryDeck is an &lt;a href=&quot;https://telemetrydeck.com&quot;&gt;app analytics service&lt;/a&gt; specifically for developers, designed to manage usage analytics that are anonymized, privacy-focused, and really easy to use. TelemetryDeck is managing the data of over 16 million people every month, helping thousands of app publishers improve their products, and we’re doing it all with a Swift-based infrastructure.&lt;/p&gt;

&lt;p&gt;The decision to go with Swift brought a lot of unexpected advantages for us. We come from a world of iOS in the frontend, Python, Node, or Ruby in the backend for server-based applications. Compared to these languages and frameworks, Swift is just as easy to use, and its compiled nature allows us to catch a lot of possible errors at compile time instead of runtime, making it ideal for a hardened, high-performance web service.&lt;/p&gt;

&lt;p&gt;Let me share our journey and history with you.&lt;/p&gt;

&lt;h2 id=&quot;adopting-swift-for-backend-services&quot; class=&quot;header-with-anchor&quot;&gt;Adopting Swift for backend services &lt;a title=&quot;Permalink for Adopting Swift for backend services section&quot; href=&quot;#adopting-swift-for-backend-services&quot;&gt;
            &lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt; &lt;svg width=&quot;18px&quot; height=&quot;18px&quot; viewBox=&quot;0 0 14 14&quot; role=&quot;img&quot; focusable=&quot;false&quot; aria-hidden=&quot;true&quot; xmlns=&quot;http://www.w3.org/2000/svg&quot;&gt;&lt;path d=&quot;m 11.58824,9.823529 q 0,-0.294117 -0.20589,-0.499999 L 9.85294,7.794118 q -0.20588,-0.205883 -0.5,-0.205883 -0.30882,0 -0.52941,0.235295 0.0221,0.02206 0.13971,0.136029 0.11764,0.113971 0.15808,0.158088 0.0404,0.04412 0.1103,0.139706 0.0698,0.09559 0.0956,0.1875 0.0257,0.09191 0.0257,0.202206 0,0.294117 -0.20588,0.5 -0.20588,0.205882 -0.5,0.205882 -0.1103,0 -0.20221,-0.02573 Q 8.35293,9.301471 8.25733,9.231621 8.16173,9.161771 8.11763,9.121327 8.07353,9.080887 7.95954,8.963238 7.84557,8.845591 7.82351,8.823533 7.58086,9.051474 7.58086,9.360297 q 0,0.294118 0.20588,0.5 l 1.51471,1.522059 q 0.19853,0.19853 0.5,0.19853 0.29412,0 0.5,-0.191177 l 1.08088,-1.073529 q 0.20589,-0.205883 0.20589,-0.492648 z M 6.41912,4.639706 q 0,-0.294118 -0.20588,-0.5 L 4.69853,2.617647 q -0.20588,-0.205882 -0.5,-0.205882 -0.28677,0 -0.5,0.198529 L 2.61765,3.683823 q -0.20589,0.205883 -0.20589,0.492648 0,0.294117 0.20589,0.499999 l 1.52941,1.529412 q 0.19853,0.19853 0.5,0.19853 0.30882,0 0.52941,-0.227942 Q 5.15437,6.15441 5.03676,6.040441 4.91912,5.92647 4.87868,5.882353 4.83828,5.838233 4.76838,5.742647 q -0.0698,-0.09559 -0.0956,-0.1875 -0.0257,-0.09191 -0.0257,-0.202206 0,-0.294117 0.20588,-0.5 0.20588,-0.205882 0.5,-0.205882 0.1103,0 0.20221,0.02573 0.0919,0.02573 0.1875,0.09559 0.0956,0.06985 0.1397,0.110294 0.0441,0.04044 0.15809,0.158089 Q 6.15443,5.154409 6.17649,5.176467 6.41914,4.948526 6.41914,4.639703 z M 13,9.823529 q 0,0.882353 -0.625,1.492647 l -1.08088,1.07353 Q 10.68382,13 9.80147,13 q -0.88971,0 -1.5,-0.625 L 6.78676,10.852941 Q 6.17647,10.242647 6.17647,9.360294 q 0,-0.904412 0.64706,-1.536764 L 6.17647,7.176471 Q 5.54412,7.82353 4.64706,7.82353 q -0.88235,0 -1.5,-0.617648 L 1.617647,5.676471 Q 1,5.058824 1,4.176471 1,3.294118 1.625,2.683824 L 2.70588,1.610294 Q 3.31618,1 4.19853,1 q 0.88971,0 1.5,0.625 l 1.51471,1.522059 q 0.61029,0.610294 0.61029,1.492647 0,0.904412 -0.64706,1.536764 L 7.82353,6.823529 Q 8.45588,6.17647 9.35294,6.17647 q 0.88235,0 1.5,0.617648 l 1.52941,1.529411 Q 13,8.941176 13,9.823529 z&quot;/&gt;&lt;/svg&gt;
          &lt;/a&gt;&lt;/h2&gt;

&lt;p&gt;TelemetryDeck is built on &lt;a href=&quot;https://vapor.codes/&quot;&gt;Vapor&lt;/a&gt;, a web framework written in Swift, for building scalable APIs and services.&lt;/p&gt;

&lt;p&gt;Similar to &lt;a href=&quot;/blog/how-swifts-server-support-powers-things-cloud/&quot;&gt;other Vapor-based projects like Things&lt;/a&gt;, TelemetryDeck runs on containers hosted in Kubernetes. Our metadata lives in Postgres, and our analytics data is stored in Apache Druid. We use Swift-native connectors to access APIs for these services. Some of those come from the Swift community, others we’ve written ourselves and are giving back to the open source ecosystem.&lt;/p&gt;

&lt;p&gt;In the very beginning, when TelemetryDeck was just a little exploratory hobby project, we wanted to go with Swift on the server simply because we love Swift, and we’re pretty decent at it. Vapor was new, and we figured, let’s try this out and learn a new way to apply and combine our skills.&lt;/p&gt;

&lt;p&gt;In the end, this decision turned out to be exactly the right one and resulted in a lean architecture that is highly performant, stable, and allows us to develop and iterate quickly.&lt;/p&gt;

&lt;p&gt;Swift’s performance characteristics are remarkable, especially in multithreading. Python’s Global Interpreter Lock has long constrained true parallelism, though recent versions have improved this. Swift doesn’t face that same challenge. Our infrastructure handles 16 million users per month with resources that would buckle other architectures. The efficiency gains aren’t just theoretical — they translate directly to lower infrastructure costs and a better user experience.&lt;/p&gt;

&lt;h2 id=&quot;swifts-codable-protocol&quot; class=&quot;header-with-anchor&quot;&gt;Swift’s Codable protocol &lt;a title=&quot;Permalink for Swift’s Codable protocol section&quot; href=&quot;#swifts-codable-protocol&quot;&gt;
            &lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt; &lt;svg width=&quot;18px&quot; height=&quot;18px&quot; viewBox=&quot;0 0 14 14&quot; role=&quot;img&quot; focusable=&quot;false&quot; aria-hidden=&quot;true&quot; xmlns=&quot;http://www.w3.org/2000/svg&quot;&gt;&lt;path d=&quot;m 11.58824,9.823529 q 0,-0.294117 -0.20589,-0.499999 L 9.85294,7.794118 q -0.20588,-0.205883 -0.5,-0.205883 -0.30882,0 -0.52941,0.235295 0.0221,0.02206 0.13971,0.136029 0.11764,0.113971 0.15808,0.158088 0.0404,0.04412 0.1103,0.139706 0.0698,0.09559 0.0956,0.1875 0.0257,0.09191 0.0257,0.202206 0,0.294117 -0.20588,0.5 -0.20588,0.205882 -0.5,0.205882 -0.1103,0 -0.20221,-0.02573 Q 8.35293,9.301471 8.25733,9.231621 8.16173,9.161771 8.11763,9.121327 8.07353,9.080887 7.95954,8.963238 7.84557,8.845591 7.82351,8.823533 7.58086,9.051474 7.58086,9.360297 q 0,0.294118 0.20588,0.5 l 1.51471,1.522059 q 0.19853,0.19853 0.5,0.19853 0.29412,0 0.5,-0.191177 l 1.08088,-1.073529 q 0.20589,-0.205883 0.20589,-0.492648 z M 6.41912,4.639706 q 0,-0.294118 -0.20588,-0.5 L 4.69853,2.617647 q -0.20588,-0.205882 -0.5,-0.205882 -0.28677,0 -0.5,0.198529 L 2.61765,3.683823 q -0.20589,0.205883 -0.20589,0.492648 0,0.294117 0.20589,0.499999 l 1.52941,1.529412 q 0.19853,0.19853 0.5,0.19853 0.30882,0 0.52941,-0.227942 Q 5.15437,6.15441 5.03676,6.040441 4.91912,5.92647 4.87868,5.882353 4.83828,5.838233 4.76838,5.742647 q -0.0698,-0.09559 -0.0956,-0.1875 -0.0257,-0.09191 -0.0257,-0.202206 0,-0.294117 0.20588,-0.5 0.20588,-0.205882 0.5,-0.205882 0.1103,0 0.20221,0.02573 0.0919,0.02573 0.1875,0.09559 0.0956,0.06985 0.1397,0.110294 0.0441,0.04044 0.15809,0.158089 Q 6.15443,5.154409 6.17649,5.176467 6.41914,4.948526 6.41914,4.639703 z M 13,9.823529 q 0,0.882353 -0.625,1.492647 l -1.08088,1.07353 Q 10.68382,13 9.80147,13 q -0.88971,0 -1.5,-0.625 L 6.78676,10.852941 Q 6.17647,10.242647 6.17647,9.360294 q 0,-0.904412 0.64706,-1.536764 L 6.17647,7.176471 Q 5.54412,7.82353 4.64706,7.82353 q -0.88235,0 -1.5,-0.617648 L 1.617647,5.676471 Q 1,5.058824 1,4.176471 1,3.294118 1.625,2.683824 L 2.70588,1.610294 Q 3.31618,1 4.19853,1 q 0.88971,0 1.5,0.625 l 1.51471,1.522059 q 0.61029,0.610294 0.61029,1.492647 0,0.904412 -0.64706,1.536764 L 7.82353,6.823529 Q 8.45588,6.17647 9.35294,6.17647 q 0.88235,0 1.5,0.617648 l 1.52941,1.529411 Q 13,8.941176 13,9.823529 z&quot;/&gt;&lt;/svg&gt;
          &lt;/a&gt;&lt;/h2&gt;

&lt;p&gt;In an API-based application, you spend an enormous amount of time encoding and decoding JSON. Swift’s Codable protocol turns what’s traditionally error-prone boilerplate into straightforward, type-safe operations. When a request comes in with malformed data, Swift’s type system rejects it immediately with no manual validation required. This isn’t just convenient; it’s a security feature that prevents entire classes of vulnerabilities.&lt;/p&gt;

&lt;div class=&quot;language-swift highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;kd&quot;&gt;struct&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;Notebook&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;Codable&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;Content&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;let&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;appID&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;UUID&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;snapshots&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;NotebookSnapshot&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;let&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;createdAt&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;Date&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;let&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;title&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;String&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;With just these few lines, we get parsing, validation, and type safety.&lt;/p&gt;

&lt;p&gt;Just like the postal system – which only accepts letters addressed in a specific format – the API endpoint described in the above bit of code will reject any data that doesn’t fit into this Codable.&lt;/p&gt;

&lt;p&gt;We don’t have to check for types, additional properties, or JSON validity, something that lets us trust our APIs more when developing and sleep easy after deploying. “Just lick the stamp and send it,” as a friend of mine once encouraged me.&lt;/p&gt;

&lt;h2 id=&quot;sharing-data-transfer-objects-between-client-and-server&quot; class=&quot;header-with-anchor&quot;&gt;Sharing Data Transfer Objects between Client and Server &lt;a title=&quot;Permalink for Sharing Data Transfer Objects between Client and Server section&quot; href=&quot;#sharing-data-transfer-objects-between-client-and-server&quot;&gt;
            &lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt; &lt;svg width=&quot;18px&quot; height=&quot;18px&quot; viewBox=&quot;0 0 14 14&quot; role=&quot;img&quot; focusable=&quot;false&quot; aria-hidden=&quot;true&quot; xmlns=&quot;http://www.w3.org/2000/svg&quot;&gt;&lt;path d=&quot;m 11.58824,9.823529 q 0,-0.294117 -0.20589,-0.499999 L 9.85294,7.794118 q -0.20588,-0.205883 -0.5,-0.205883 -0.30882,0 -0.52941,0.235295 0.0221,0.02206 0.13971,0.136029 0.11764,0.113971 0.15808,0.158088 0.0404,0.04412 0.1103,0.139706 0.0698,0.09559 0.0956,0.1875 0.0257,0.09191 0.0257,0.202206 0,0.294117 -0.20588,0.5 -0.20588,0.205882 -0.5,0.205882 -0.1103,0 -0.20221,-0.02573 Q 8.35293,9.301471 8.25733,9.231621 8.16173,9.161771 8.11763,9.121327 8.07353,9.080887 7.95954,8.963238 7.84557,8.845591 7.82351,8.823533 7.58086,9.051474 7.58086,9.360297 q 0,0.294118 0.20588,0.5 l 1.51471,1.522059 q 0.19853,0.19853 0.5,0.19853 0.29412,0 0.5,-0.191177 l 1.08088,-1.073529 q 0.20589,-0.205883 0.20589,-0.492648 z M 6.41912,4.639706 q 0,-0.294118 -0.20588,-0.5 L 4.69853,2.617647 q -0.20588,-0.205882 -0.5,-0.205882 -0.28677,0 -0.5,0.198529 L 2.61765,3.683823 q -0.20589,0.205883 -0.20589,0.492648 0,0.294117 0.20589,0.499999 l 1.52941,1.529412 q 0.19853,0.19853 0.5,0.19853 0.30882,0 0.52941,-0.227942 Q 5.15437,6.15441 5.03676,6.040441 4.91912,5.92647 4.87868,5.882353 4.83828,5.838233 4.76838,5.742647 q -0.0698,-0.09559 -0.0956,-0.1875 -0.0257,-0.09191 -0.0257,-0.202206 0,-0.294117 0.20588,-0.5 0.20588,-0.205882 0.5,-0.205882 0.1103,0 0.20221,0.02573 0.0919,0.02573 0.1875,0.09559 0.0956,0.06985 0.1397,0.110294 0.0441,0.04044 0.15809,0.158089 Q 6.15443,5.154409 6.17649,5.176467 6.41914,4.948526 6.41914,4.639703 z M 13,9.823529 q 0,0.882353 -0.625,1.492647 l -1.08088,1.07353 Q 10.68382,13 9.80147,13 q -0.88971,0 -1.5,-0.625 L 6.78676,10.852941 Q 6.17647,10.242647 6.17647,9.360294 q 0,-0.904412 0.64706,-1.536764 L 6.17647,7.176471 Q 5.54412,7.82353 4.64706,7.82353 q -0.88235,0 -1.5,-0.617648 L 1.617647,5.676471 Q 1,5.058824 1,4.176471 1,3.294118 1.625,2.683824 L 2.70588,1.610294 Q 3.31618,1 4.19853,1 q 0.88971,0 1.5,0.625 l 1.51471,1.522059 q 0.61029,0.610294 0.61029,1.492647 0,0.904412 -0.64706,1.536764 L 7.82353,6.823529 Q 8.45588,6.17647 9.35294,6.17647 q 0.88235,0 1.5,0.617648 l 1.52941,1.529411 Q 13,8.941176 13,9.823529 z&quot;/&gt;&lt;/svg&gt;
          &lt;/a&gt;&lt;/h2&gt;

&lt;p&gt;For a long time, TelemetryDeck offered a SwiftUI-based desktop application for interacting with analytics data, displaying dashboards, and exploring correlations. This meant we could use the same structs for encoding data on the server and decoding it on the client – these are called Data Transfer Objects or DTOs. We kept a separate package “SwiftDTOs” that was shared between both clients and the server code.&lt;/p&gt;

&lt;p&gt;However, we ran into trouble when we updated our APIs to new versions with slightly different inputs and outputs. We always have the API version in our paths, which helps us continuously develop them while keeping compatibility with clients that take a while to update. This pattern made it hard to update Data Transfer Objects quickly because changing a struct for one API version could break another.&lt;/p&gt;

&lt;p&gt;For our newest API version, we abandoned this approach. DTOs now live directly in their controllers as inline structs:&lt;/p&gt;

&lt;div class=&quot;language-swift highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;kd&quot;&gt;extension&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;V3QueryController&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;kd&quot;&gt;struct&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;QueryRequest&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;Codable&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;k&quot;&gt;let&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;query&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;QueryDefinition&lt;/span&gt;
        &lt;span class=&quot;k&quot;&gt;let&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;timeRange&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;TimeRange&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;

    &lt;span class=&quot;kd&quot;&gt;struct&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;QueryResponse&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;Codable&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;k&quot;&gt;let&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;results&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;QueryResult&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;
        &lt;span class=&quot;k&quot;&gt;let&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;metadata&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;ResponseMetadata&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;The lesson? Keep your DTOs close to your controllers. It’s simpler, more maintainable, and makes changes easier. Sometimes the obvious solution is the right one.&lt;/p&gt;

&lt;h2 id=&quot;developer-experience-matters&quot; class=&quot;header-with-anchor&quot;&gt;Developer experience matters &lt;a title=&quot;Permalink for Developer experience matters section&quot; href=&quot;#developer-experience-matters&quot;&gt;
            &lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt; &lt;svg width=&quot;18px&quot; height=&quot;18px&quot; viewBox=&quot;0 0 14 14&quot; role=&quot;img&quot; focusable=&quot;false&quot; aria-hidden=&quot;true&quot; xmlns=&quot;http://www.w3.org/2000/svg&quot;&gt;&lt;path d=&quot;m 11.58824,9.823529 q 0,-0.294117 -0.20589,-0.499999 L 9.85294,7.794118 q -0.20588,-0.205883 -0.5,-0.205883 -0.30882,0 -0.52941,0.235295 0.0221,0.02206 0.13971,0.136029 0.11764,0.113971 0.15808,0.158088 0.0404,0.04412 0.1103,0.139706 0.0698,0.09559 0.0956,0.1875 0.0257,0.09191 0.0257,0.202206 0,0.294117 -0.20588,0.5 -0.20588,0.205882 -0.5,0.205882 -0.1103,0 -0.20221,-0.02573 Q 8.35293,9.301471 8.25733,9.231621 8.16173,9.161771 8.11763,9.121327 8.07353,9.080887 7.95954,8.963238 7.84557,8.845591 7.82351,8.823533 7.58086,9.051474 7.58086,9.360297 q 0,0.294118 0.20588,0.5 l 1.51471,1.522059 q 0.19853,0.19853 0.5,0.19853 0.29412,0 0.5,-0.191177 l 1.08088,-1.073529 q 0.20589,-0.205883 0.20589,-0.492648 z M 6.41912,4.639706 q 0,-0.294118 -0.20588,-0.5 L 4.69853,2.617647 q -0.20588,-0.205882 -0.5,-0.205882 -0.28677,0 -0.5,0.198529 L 2.61765,3.683823 q -0.20589,0.205883 -0.20589,0.492648 0,0.294117 0.20589,0.499999 l 1.52941,1.529412 q 0.19853,0.19853 0.5,0.19853 0.30882,0 0.52941,-0.227942 Q 5.15437,6.15441 5.03676,6.040441 4.91912,5.92647 4.87868,5.882353 4.83828,5.838233 4.76838,5.742647 q -0.0698,-0.09559 -0.0956,-0.1875 -0.0257,-0.09191 -0.0257,-0.202206 0,-0.294117 0.20588,-0.5 0.20588,-0.205882 0.5,-0.205882 0.1103,0 0.20221,0.02573 0.0919,0.02573 0.1875,0.09559 0.0956,0.06985 0.1397,0.110294 0.0441,0.04044 0.15809,0.158089 Q 6.15443,5.154409 6.17649,5.176467 6.41914,4.948526 6.41914,4.639703 z M 13,9.823529 q 0,0.882353 -0.625,1.492647 l -1.08088,1.07353 Q 10.68382,13 9.80147,13 q -0.88971,0 -1.5,-0.625 L 6.78676,10.852941 Q 6.17647,10.242647 6.17647,9.360294 q 0,-0.904412 0.64706,-1.536764 L 6.17647,7.176471 Q 5.54412,7.82353 4.64706,7.82353 q -0.88235,0 -1.5,-0.617648 L 1.617647,5.676471 Q 1,5.058824 1,4.176471 1,3.294118 1.625,2.683824 L 2.70588,1.610294 Q 3.31618,1 4.19853,1 q 0.88971,0 1.5,0.625 l 1.51471,1.522059 q 0.61029,0.610294 0.61029,1.492647 0,0.904412 -0.64706,1.536764 L 7.82353,6.823529 Q 8.45588,6.17647 9.35294,6.17647 q 0.88235,0 1.5,0.617648 l 1.52941,1.529411 Q 13,8.941176 13,9.823529 z&quot;/&gt;&lt;/svg&gt;
          &lt;/a&gt;&lt;/h2&gt;

&lt;p&gt;One underappreciated aspect of Swift on the server is the development experience. Swift services can be developed using your favorite IDE, including VS Code, Cursor, Xcode, and editors supporting the Language Server Protocol (LSP). We chose to develop in Xcode, our favorite IDE, with full debugging capabilities.&lt;/p&gt;

&lt;p&gt;Under the hood, a Swift Vapor project is just a Swift Package with some dependencies. You open it in Xcode, you press Cmd+U to run the tests, you run it and set breakpoints and step through them when you’re following a bug through the stack.&lt;/p&gt;

&lt;p&gt;Our web API services usually have a database attached to them, so when we’re developing, we can either run PostgreSQL on our machines right next to the code, or we can ask Swift Vapor’s database layer (Fluent) to use a different database for development, such as a local SQLite file.&lt;/p&gt;

&lt;p&gt;The end result is a very comfortable experience that allows us to use an IDE specifically built for Swift development, without needing to spin up containers.&lt;/p&gt;

&lt;p&gt;This flexibility matters when you’re building a business. We can onboard new developers quickly because the tooling is familiar. We can iterate rapidly because the feedback loop is tight. And we can maintain high code quality because Swift’s type system catches errors at compile time, not in production.&lt;/p&gt;

&lt;h2 id=&quot;building-the-ecosystem-we-want-to-use&quot; class=&quot;header-with-anchor&quot;&gt;Building the ecosystem we want to use &lt;a title=&quot;Permalink for Building the ecosystem we want to use section&quot; href=&quot;#building-the-ecosystem-we-want-to-use&quot;&gt;
            &lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt; &lt;svg width=&quot;18px&quot; height=&quot;18px&quot; viewBox=&quot;0 0 14 14&quot; role=&quot;img&quot; focusable=&quot;false&quot; aria-hidden=&quot;true&quot; xmlns=&quot;http://www.w3.org/2000/svg&quot;&gt;&lt;path d=&quot;m 11.58824,9.823529 q 0,-0.294117 -0.20589,-0.499999 L 9.85294,7.794118 q -0.20588,-0.205883 -0.5,-0.205883 -0.30882,0 -0.52941,0.235295 0.0221,0.02206 0.13971,0.136029 0.11764,0.113971 0.15808,0.158088 0.0404,0.04412 0.1103,0.139706 0.0698,0.09559 0.0956,0.1875 0.0257,0.09191 0.0257,0.202206 0,0.294117 -0.20588,0.5 -0.20588,0.205882 -0.5,0.205882 -0.1103,0 -0.20221,-0.02573 Q 8.35293,9.301471 8.25733,9.231621 8.16173,9.161771 8.11763,9.121327 8.07353,9.080887 7.95954,8.963238 7.84557,8.845591 7.82351,8.823533 7.58086,9.051474 7.58086,9.360297 q 0,0.294118 0.20588,0.5 l 1.51471,1.522059 q 0.19853,0.19853 0.5,0.19853 0.29412,0 0.5,-0.191177 l 1.08088,-1.073529 q 0.20589,-0.205883 0.20589,-0.492648 z M 6.41912,4.639706 q 0,-0.294118 -0.20588,-0.5 L 4.69853,2.617647 q -0.20588,-0.205882 -0.5,-0.205882 -0.28677,0 -0.5,0.198529 L 2.61765,3.683823 q -0.20589,0.205883 -0.20589,0.492648 0,0.294117 0.20589,0.499999 l 1.52941,1.529412 q 0.19853,0.19853 0.5,0.19853 0.30882,0 0.52941,-0.227942 Q 5.15437,6.15441 5.03676,6.040441 4.91912,5.92647 4.87868,5.882353 4.83828,5.838233 4.76838,5.742647 q -0.0698,-0.09559 -0.0956,-0.1875 -0.0257,-0.09191 -0.0257,-0.202206 0,-0.294117 0.20588,-0.5 0.20588,-0.205882 0.5,-0.205882 0.1103,0 0.20221,0.02573 0.0919,0.02573 0.1875,0.09559 0.0956,0.06985 0.1397,0.110294 0.0441,0.04044 0.15809,0.158089 Q 6.15443,5.154409 6.17649,5.176467 6.41914,4.948526 6.41914,4.639703 z M 13,9.823529 q 0,0.882353 -0.625,1.492647 l -1.08088,1.07353 Q 10.68382,13 9.80147,13 q -0.88971,0 -1.5,-0.625 L 6.78676,10.852941 Q 6.17647,10.242647 6.17647,9.360294 q 0,-0.904412 0.64706,-1.536764 L 6.17647,7.176471 Q 5.54412,7.82353 4.64706,7.82353 q -0.88235,0 -1.5,-0.617648 L 1.617647,5.676471 Q 1,5.058824 1,4.176471 1,3.294118 1.625,2.683824 L 2.70588,1.610294 Q 3.31618,1 4.19853,1 q 0.88971,0 1.5,0.625 l 1.51471,1.522059 q 0.61029,0.610294 0.61029,1.492647 0,0.904412 -0.64706,1.536764 L 7.82353,6.823529 Q 8.45588,6.17647 9.35294,6.17647 q 0.88235,0 1.5,0.617648 l 1.52941,1.529411 Q 13,8.941176 13,9.823529 z&quot;/&gt;&lt;/svg&gt;
          &lt;/a&gt;&lt;/h2&gt;

&lt;p&gt;We love the open source ecosystem around Swift on the server. There are Swift packages for external services like payment providers and transactional emails. There are tools like &lt;a href=&quot;https://github.com/vapor-community/Imperial&quot;&gt;Imperial&lt;/a&gt; for Single Sign-On, and &lt;a href=&quot;https://github.com/apple/swift-crypto&quot;&gt;Swift Crypto&lt;/a&gt; for standards-compliant cryptography.&lt;/p&gt;

&lt;p&gt;Whenever a piece of the puzzle is missing, we try to give back as much as possible. That is partly because the Swift developer community is fantastic in coming up with SDKs for various services, and we try to contribute to existing projects like StripeKit (where we added support for a lot of APIs that Stripe released) or even release our own new SDKs like &lt;a href=&quot;https://github.com/TelemetryDeck/brevo-kit&quot;&gt;BrevoKit&lt;/a&gt;.&lt;/p&gt;

&lt;h2 id=&quot;lessons-learned&quot; class=&quot;header-with-anchor&quot;&gt;Lessons learned &lt;a title=&quot;Permalink for Lessons learned section&quot; href=&quot;#lessons-learned&quot;&gt;
            &lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt; &lt;svg width=&quot;18px&quot; height=&quot;18px&quot; viewBox=&quot;0 0 14 14&quot; role=&quot;img&quot; focusable=&quot;false&quot; aria-hidden=&quot;true&quot; xmlns=&quot;http://www.w3.org/2000/svg&quot;&gt;&lt;path d=&quot;m 11.58824,9.823529 q 0,-0.294117 -0.20589,-0.499999 L 9.85294,7.794118 q -0.20588,-0.205883 -0.5,-0.205883 -0.30882,0 -0.52941,0.235295 0.0221,0.02206 0.13971,0.136029 0.11764,0.113971 0.15808,0.158088 0.0404,0.04412 0.1103,0.139706 0.0698,0.09559 0.0956,0.1875 0.0257,0.09191 0.0257,0.202206 0,0.294117 -0.20588,0.5 -0.20588,0.205882 -0.5,0.205882 -0.1103,0 -0.20221,-0.02573 Q 8.35293,9.301471 8.25733,9.231621 8.16173,9.161771 8.11763,9.121327 8.07353,9.080887 7.95954,8.963238 7.84557,8.845591 7.82351,8.823533 7.58086,9.051474 7.58086,9.360297 q 0,0.294118 0.20588,0.5 l 1.51471,1.522059 q 0.19853,0.19853 0.5,0.19853 0.29412,0 0.5,-0.191177 l 1.08088,-1.073529 q 0.20589,-0.205883 0.20589,-0.492648 z M 6.41912,4.639706 q 0,-0.294118 -0.20588,-0.5 L 4.69853,2.617647 q -0.20588,-0.205882 -0.5,-0.205882 -0.28677,0 -0.5,0.198529 L 2.61765,3.683823 q -0.20589,0.205883 -0.20589,0.492648 0,0.294117 0.20589,0.499999 l 1.52941,1.529412 q 0.19853,0.19853 0.5,0.19853 0.30882,0 0.52941,-0.227942 Q 5.15437,6.15441 5.03676,6.040441 4.91912,5.92647 4.87868,5.882353 4.83828,5.838233 4.76838,5.742647 q -0.0698,-0.09559 -0.0956,-0.1875 -0.0257,-0.09191 -0.0257,-0.202206 0,-0.294117 0.20588,-0.5 0.20588,-0.205882 0.5,-0.205882 0.1103,0 0.20221,0.02573 0.0919,0.02573 0.1875,0.09559 0.0956,0.06985 0.1397,0.110294 0.0441,0.04044 0.15809,0.158089 Q 6.15443,5.154409 6.17649,5.176467 6.41914,4.948526 6.41914,4.639703 z M 13,9.823529 q 0,0.882353 -0.625,1.492647 l -1.08088,1.07353 Q 10.68382,13 9.80147,13 q -0.88971,0 -1.5,-0.625 L 6.78676,10.852941 Q 6.17647,10.242647 6.17647,9.360294 q 0,-0.904412 0.64706,-1.536764 L 6.17647,7.176471 Q 5.54412,7.82353 4.64706,7.82353 q -0.88235,0 -1.5,-0.617648 L 1.617647,5.676471 Q 1,5.058824 1,4.176471 1,3.294118 1.625,2.683824 L 2.70588,1.610294 Q 3.31618,1 4.19853,1 q 0.88971,0 1.5,0.625 l 1.51471,1.522059 q 0.61029,0.610294 0.61029,1.492647 0,0.904412 -0.64706,1.536764 L 7.82353,6.823529 Q 8.45588,6.17647 9.35294,6.17647 q 0.88235,0 1.5,0.617648 l 1.52941,1.529411 Q 13,8.941176 13,9.823529 z&quot;/&gt;&lt;/svg&gt;
          &lt;/a&gt;&lt;/h2&gt;

&lt;p&gt;Building a production service teaches you things that tutorials never will. Here are some hard-won lessons from our journey:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Use the Swift Package system.&lt;/strong&gt; A package is a fantastic way to structure and isolate code. Since our services are packages anyway, it’s natural to further subdivide them where it makes sense.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Your Swift Vapor service is almost never the bottleneck.&lt;/strong&gt; Although profiling Swift code is easy, most slowdowns in a web service will arise from a combination of database, storage, and traffic load. You’ll migrate the way you store and access data frequently as you gain experience.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Embrace Vapor’s built-in features.&lt;/strong&gt; Queues and jobs, migrations, and middleware. Vapor has mature solutions for common patterns. We use Fluent almost exclusively over raw SQL, and Vapor’s queue system handles everything from data processing to billing tasks.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Version your API URLs from day one.&lt;/strong&gt; You’ll thank yourself later when you need to evolve your API without breaking existing clients.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Always set cache expiration times.&lt;/strong&gt; It sounds obvious, but that Redis cache that “will never grow too large” absolutely will. Set reasonable TTLs on everything that you cache.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Monitor errors and performance.&lt;/strong&gt; When you build an iPhone app, you automatically get crash logs that help you find out where things are going wrong for your users. On the server, you’ll have to collect those yourself. Before we started doing that, our customers would discover problems before we did, and that never feels good or professional.&lt;/p&gt;

&lt;p&gt;Now we use a combination of &lt;a href=&quot;https://github.com/apple/swift-distributed-tracing&quot;&gt;Swift Distributed Tracing&lt;/a&gt; and our own analytics-based middleware to find performance bottlenecks and errors that are predictors of service crashes, and we can right the ship before most of our customers notice.&lt;/p&gt;

&lt;h2 id=&quot;where-we-are-now&quot; class=&quot;header-with-anchor&quot;&gt;Where we are now &lt;a title=&quot;Permalink for Where we are now section&quot; href=&quot;#where-we-are-now&quot;&gt;
            &lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt; &lt;svg width=&quot;18px&quot; height=&quot;18px&quot; viewBox=&quot;0 0 14 14&quot; role=&quot;img&quot; focusable=&quot;false&quot; aria-hidden=&quot;true&quot; xmlns=&quot;http://www.w3.org/2000/svg&quot;&gt;&lt;path d=&quot;m 11.58824,9.823529 q 0,-0.294117 -0.20589,-0.499999 L 9.85294,7.794118 q -0.20588,-0.205883 -0.5,-0.205883 -0.30882,0 -0.52941,0.235295 0.0221,0.02206 0.13971,0.136029 0.11764,0.113971 0.15808,0.158088 0.0404,0.04412 0.1103,0.139706 0.0698,0.09559 0.0956,0.1875 0.0257,0.09191 0.0257,0.202206 0,0.294117 -0.20588,0.5 -0.20588,0.205882 -0.5,0.205882 -0.1103,0 -0.20221,-0.02573 Q 8.35293,9.301471 8.25733,9.231621 8.16173,9.161771 8.11763,9.121327 8.07353,9.080887 7.95954,8.963238 7.84557,8.845591 7.82351,8.823533 7.58086,9.051474 7.58086,9.360297 q 0,0.294118 0.20588,0.5 l 1.51471,1.522059 q 0.19853,0.19853 0.5,0.19853 0.29412,0 0.5,-0.191177 l 1.08088,-1.073529 q 0.20589,-0.205883 0.20589,-0.492648 z M 6.41912,4.639706 q 0,-0.294118 -0.20588,-0.5 L 4.69853,2.617647 q -0.20588,-0.205882 -0.5,-0.205882 -0.28677,0 -0.5,0.198529 L 2.61765,3.683823 q -0.20589,0.205883 -0.20589,0.492648 0,0.294117 0.20589,0.499999 l 1.52941,1.529412 q 0.19853,0.19853 0.5,0.19853 0.30882,0 0.52941,-0.227942 Q 5.15437,6.15441 5.03676,6.040441 4.91912,5.92647 4.87868,5.882353 4.83828,5.838233 4.76838,5.742647 q -0.0698,-0.09559 -0.0956,-0.1875 -0.0257,-0.09191 -0.0257,-0.202206 0,-0.294117 0.20588,-0.5 0.20588,-0.205882 0.5,-0.205882 0.1103,0 0.20221,0.02573 0.0919,0.02573 0.1875,0.09559 0.0956,0.06985 0.1397,0.110294 0.0441,0.04044 0.15809,0.158089 Q 6.15443,5.154409 6.17649,5.176467 6.41914,4.948526 6.41914,4.639703 z M 13,9.823529 q 0,0.882353 -0.625,1.492647 l -1.08088,1.07353 Q 10.68382,13 9.80147,13 q -0.88971,0 -1.5,-0.625 L 6.78676,10.852941 Q 6.17647,10.242647 6.17647,9.360294 q 0,-0.904412 0.64706,-1.536764 L 6.17647,7.176471 Q 5.54412,7.82353 4.64706,7.82353 q -0.88235,0 -1.5,-0.617648 L 1.617647,5.676471 Q 1,5.058824 1,4.176471 1,3.294118 1.625,2.683824 L 2.70588,1.610294 Q 3.31618,1 4.19853,1 q 0.88971,0 1.5,0.625 l 1.51471,1.522059 q 0.61029,0.610294 0.61029,1.492647 0,0.904412 -0.64706,1.536764 L 7.82353,6.823529 Q 8.45588,6.17647 9.35294,6.17647 q 0.88235,0 1.5,0.617648 l 1.52941,1.529411 Q 13,8.941176 13,9.823529 z&quot;/&gt;&lt;/svg&gt;
          &lt;/a&gt;&lt;/h2&gt;

&lt;p&gt;TelemetryDeck proves that Swift isn’t just for apps — it’s a legitimate choice for building scalable, performant backend services. We’re processing millions of events, serving thousands of developers, and doing it all with Swift and Vapor. The language that powers apps on billions of iOS devices is equally capable of powering the services behind them.&lt;/p&gt;

&lt;p&gt;The performance gains are real: we can crunch and encode tens of thousands of data points in milliseconds. The development velocity is fantastic: we work in Xcode and write tests for behaviour and not for data parsing. And the type safety prevents entire categories of bugs that dynamically typed languages like Python or JavaScript need additional code to guard against. Perhaps most importantly, the joy of writing Swift makes the long hours of building a business more bearable.&lt;/p&gt;

&lt;p&gt;If you’re considering Swift for your next server-side project, take it from someone who’s built an entire business on it: Swift delivers on its promise of safe, fast, and expressive code—whether that code runs on an iPhone or in a data center.&lt;/p&gt;
</content>
  </entry>
  
  <entry>
    <title>What's new in Swift: February 2026 Edition</title>
    
      
        
        <author>
        
          <name>Karen Chu</name>
        
        </author>
      
        
        <author>
        
          <name>Dave Lester</name>
        
        </author>
      
    
    <link href="https://swift.org/blog/whats-new-in-swift-february-2026/"/>
    <updated>2026-03-02T10:05:00-04:00</updated>
    <id>https://swift.org/blog/whats-new-in-swift-february-2026/</id>
    <content type="html">&lt;p&gt;Welcome to this edition of “What’s New in Swift,” where we share interesting projects and updates in the Swift community that deserve visibility to a broader audience.&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://fosdem.org/2026/&quot;&gt;FOSDEM&lt;/a&gt; is the largest open source conference in the world, and this year Swift was featured in talks across multiple tracks and a dedicated pre-conference event. Here’s a report from the Swift community:&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;Hey there! Karen Chu here. 👋 I help grow and support the Swift open source community, and one of my favorite things has been increasing Swift’s participation in open source events.&lt;/p&gt;

  &lt;p&gt;As a follow-up to Swift’s presence at FOSDEM last year, this year we expanded our approach by running our own &lt;a href=&quot;https://swiftlang.github.io/event-fosdem/&quot;&gt;Pre-FOSDEM fringe event&lt;/a&gt;, which included 11 talks across multiple platforms, in addition to &lt;a href=&quot;https://swiftlang.github.io/event-fosdem/#swift-talks-at-fosdem&quot;&gt;four Swift talks across various devroom tracks&lt;/a&gt;.&lt;/p&gt;

  &lt;p&gt;Though it was my first year at FOSDEM, it was delightful to meet several people who attended the Swift devroom last year and also came through again this year. With the vast array of attendee backgrounds (I met recent grads, former Swift mentees, Swift workgroup members, folks from the Swift Core Team, and more) and talks covering different platforms (embedded, server, BSD, Android, and more), that weekend showed me just how much momentum Swift has gained as a general purpose language that can benefit everyone.&lt;/p&gt;

  &lt;p&gt;I wanted to highlight Simon Leeb’s talk, &lt;a href=&quot;https://www.youtube.com/watch?v=OmQ881sOTIc&amp;amp;list=PLeb93j_rsErO182fdoJ4m1p_suKAOcBnM&amp;amp;index=6&quot;&gt;Swift in the Browser with ElementaryUI&lt;/a&gt;, as a popular talk from the event which showed how to run Swift applications natively in the browser with WebAssembly.&lt;/p&gt;

  &lt;p&gt;FOSDEM may be over (for now), but I’m already excited about how the Swift community will show up next year!&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;To catch up on &lt;em&gt;all&lt;/em&gt; the talks at the Pre-FOSDEM event, check out the &lt;a href=&quot;https://www.youtube.com/watch?v=jAgydnnjj0Y&amp;amp;list=PLeb93j_rsErO182fdoJ4m1p_suKAOcBnM&quot;&gt;YouTube playlist&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Now on to other news about Swift:&lt;/p&gt;

&lt;h2 id=&quot;new-package-releases&quot; class=&quot;header-with-anchor&quot;&gt;New package releases &lt;a title=&quot;Permalink for New package releases section&quot; href=&quot;#new-package-releases&quot;&gt;
            &lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt; &lt;svg width=&quot;18px&quot; height=&quot;18px&quot; viewBox=&quot;0 0 14 14&quot; role=&quot;img&quot; focusable=&quot;false&quot; aria-hidden=&quot;true&quot; xmlns=&quot;http://www.w3.org/2000/svg&quot;&gt;&lt;path d=&quot;m 11.58824,9.823529 q 0,-0.294117 -0.20589,-0.499999 L 9.85294,7.794118 q -0.20588,-0.205883 -0.5,-0.205883 -0.30882,0 -0.52941,0.235295 0.0221,0.02206 0.13971,0.136029 0.11764,0.113971 0.15808,0.158088 0.0404,0.04412 0.1103,0.139706 0.0698,0.09559 0.0956,0.1875 0.0257,0.09191 0.0257,0.202206 0,0.294117 -0.20588,0.5 -0.20588,0.205882 -0.5,0.205882 -0.1103,0 -0.20221,-0.02573 Q 8.35293,9.301471 8.25733,9.231621 8.16173,9.161771 8.11763,9.121327 8.07353,9.080887 7.95954,8.963238 7.84557,8.845591 7.82351,8.823533 7.58086,9.051474 7.58086,9.360297 q 0,0.294118 0.20588,0.5 l 1.51471,1.522059 q 0.19853,0.19853 0.5,0.19853 0.29412,0 0.5,-0.191177 l 1.08088,-1.073529 q 0.20589,-0.205883 0.20589,-0.492648 z M 6.41912,4.639706 q 0,-0.294118 -0.20588,-0.5 L 4.69853,2.617647 q -0.20588,-0.205882 -0.5,-0.205882 -0.28677,0 -0.5,0.198529 L 2.61765,3.683823 q -0.20589,0.205883 -0.20589,0.492648 0,0.294117 0.20589,0.499999 l 1.52941,1.529412 q 0.19853,0.19853 0.5,0.19853 0.30882,0 0.52941,-0.227942 Q 5.15437,6.15441 5.03676,6.040441 4.91912,5.92647 4.87868,5.882353 4.83828,5.838233 4.76838,5.742647 q -0.0698,-0.09559 -0.0956,-0.1875 -0.0257,-0.09191 -0.0257,-0.202206 0,-0.294117 0.20588,-0.5 0.20588,-0.205882 0.5,-0.205882 0.1103,0 0.20221,0.02573 0.0919,0.02573 0.1875,0.09559 0.0956,0.06985 0.1397,0.110294 0.0441,0.04044 0.15809,0.158089 Q 6.15443,5.154409 6.17649,5.176467 6.41914,4.948526 6.41914,4.639703 z M 13,9.823529 q 0,0.882353 -0.625,1.492647 l -1.08088,1.07353 Q 10.68382,13 9.80147,13 q -0.88971,0 -1.5,-0.625 L 6.78676,10.852941 Q 6.17647,10.242647 6.17647,9.360294 q 0,-0.904412 0.64706,-1.536764 L 6.17647,7.176471 Q 5.54412,7.82353 4.64706,7.82353 q -0.88235,0 -1.5,-0.617648 L 1.617647,5.676471 Q 1,5.058824 1,4.176471 1,3.294118 1.625,2.683824 L 2.70588,1.610294 Q 3.31618,1 4.19853,1 q 0.88971,0 1.5,0.625 l 1.51471,1.522059 q 0.61029,0.610294 0.61029,1.492647 0,0.904412 -0.64706,1.536764 L 7.82353,6.823529 Q 8.45588,6.17647 9.35294,6.17647 q 0.88235,0 1.5,0.617648 l 1.52941,1.529411 Q 13,8.941176 13,9.823529 z&quot;/&gt;&lt;/svg&gt;
          &lt;/a&gt;&lt;/h2&gt;
&lt;ul&gt;
  &lt;li&gt;Originally developed for searching financial databases for strings like stock tickers, &lt;a href=&quot;https://github.com/ordo-one/FuzzyMatch&quot;&gt;FuzzyMatch&lt;/a&gt; brings high-performance fuzzy string matching to Swift.&lt;/li&gt;
  &lt;li&gt;Now you can expose GraphQL APIs in your applications with new &lt;a href=&quot;https://forums.swift.org/t/introducing-graphql-vapor-hummingbird-packages/84758&quot;&gt;Vapor and Hummingbird packages&lt;/a&gt;.&lt;/li&gt;
  &lt;li&gt;Using Microsoft SQL Server? &lt;a href=&quot;https://github.com/vkuttyp/SQLClient-Swift&quot;&gt;SQLClient-Swift&lt;/a&gt; is a native client for iOS, macOS, and Linux that’s built using modern Swift concurrency.&lt;/li&gt;
  &lt;li&gt;Developers now have more options to create terminal-based Swift applications with &lt;a href=&quot;https://tuikit.dev&quot;&gt;TuiKit&lt;/a&gt;, a declarative, SwiftUI-like framework for building Terminal User Interfaces. TuiKit joins &lt;a href=&quot;https://noora.tuist.dev&quot;&gt;Noora&lt;/a&gt;, which provides themeable components for CLIs.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Lastly, &lt;a href=&quot;https://www.swift.org/blog/swift-system-metrics-1.0-released/&quot;&gt;Swift System Metrics 1.0&lt;/a&gt; was announced, making the collection of process-level metrics easy.&lt;/p&gt;

&lt;h2 id=&quot;videos-to-watch&quot; class=&quot;header-with-anchor&quot;&gt;Videos to watch &lt;a title=&quot;Permalink for Videos to watch section&quot; href=&quot;#videos-to-watch&quot;&gt;
            &lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt; &lt;svg width=&quot;18px&quot; height=&quot;18px&quot; viewBox=&quot;0 0 14 14&quot; role=&quot;img&quot; focusable=&quot;false&quot; aria-hidden=&quot;true&quot; xmlns=&quot;http://www.w3.org/2000/svg&quot;&gt;&lt;path d=&quot;m 11.58824,9.823529 q 0,-0.294117 -0.20589,-0.499999 L 9.85294,7.794118 q -0.20588,-0.205883 -0.5,-0.205883 -0.30882,0 -0.52941,0.235295 0.0221,0.02206 0.13971,0.136029 0.11764,0.113971 0.15808,0.158088 0.0404,0.04412 0.1103,0.139706 0.0698,0.09559 0.0956,0.1875 0.0257,0.09191 0.0257,0.202206 0,0.294117 -0.20588,0.5 -0.20588,0.205882 -0.5,0.205882 -0.1103,0 -0.20221,-0.02573 Q 8.35293,9.301471 8.25733,9.231621 8.16173,9.161771 8.11763,9.121327 8.07353,9.080887 7.95954,8.963238 7.84557,8.845591 7.82351,8.823533 7.58086,9.051474 7.58086,9.360297 q 0,0.294118 0.20588,0.5 l 1.51471,1.522059 q 0.19853,0.19853 0.5,0.19853 0.29412,0 0.5,-0.191177 l 1.08088,-1.073529 q 0.20589,-0.205883 0.20589,-0.492648 z M 6.41912,4.639706 q 0,-0.294118 -0.20588,-0.5 L 4.69853,2.617647 q -0.20588,-0.205882 -0.5,-0.205882 -0.28677,0 -0.5,0.198529 L 2.61765,3.683823 q -0.20589,0.205883 -0.20589,0.492648 0,0.294117 0.20589,0.499999 l 1.52941,1.529412 q 0.19853,0.19853 0.5,0.19853 0.30882,0 0.52941,-0.227942 Q 5.15437,6.15441 5.03676,6.040441 4.91912,5.92647 4.87868,5.882353 4.83828,5.838233 4.76838,5.742647 q -0.0698,-0.09559 -0.0956,-0.1875 -0.0257,-0.09191 -0.0257,-0.202206 0,-0.294117 0.20588,-0.5 0.20588,-0.205882 0.5,-0.205882 0.1103,0 0.20221,0.02573 0.0919,0.02573 0.1875,0.09559 0.0956,0.06985 0.1397,0.110294 0.0441,0.04044 0.15809,0.158089 Q 6.15443,5.154409 6.17649,5.176467 6.41914,4.948526 6.41914,4.639703 z M 13,9.823529 q 0,0.882353 -0.625,1.492647 l -1.08088,1.07353 Q 10.68382,13 9.80147,13 q -0.88971,0 -1.5,-0.625 L 6.78676,10.852941 Q 6.17647,10.242647 6.17647,9.360294 q 0,-0.904412 0.64706,-1.536764 L 6.17647,7.176471 Q 5.54412,7.82353 4.64706,7.82353 q -0.88235,0 -1.5,-0.617648 L 1.617647,5.676471 Q 1,5.058824 1,4.176471 1,3.294118 1.625,2.683824 L 2.70588,1.610294 Q 3.31618,1 4.19853,1 q 0.88971,0 1.5,0.625 l 1.51471,1.522059 q 0.61029,0.610294 0.61029,1.492647 0,0.904412 -0.64706,1.536764 L 7.82353,6.823529 Q 8.45588,6.17647 9.35294,6.17647 q 0.88235,0 1.5,0.617648 l 1.52941,1.529411 Q 13,8.941176 13,9.823529 z&quot;/&gt;&lt;/svg&gt;
          &lt;/a&gt;&lt;/h2&gt;
&lt;ul&gt;
  &lt;li&gt;Interested in writing Swift using agents? At Swift Barcelona, a talk on &lt;a href=&quot;https://www.youtube.com/watch?v=ekOzNd1_vo8&quot;&gt;Building Agentic Apps with MCP in Swift&lt;/a&gt; demonstrated several open source tools. And if you’re an Xcode user, check out a recent &lt;a href=&quot;https://www.youtube.com/watch?v=U1WM3ALwQX8&quot;&gt;code-along covering coding intelligence in Xcode 26&lt;/a&gt;.&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://www.youtube.com/watch?v=mZNIAuQ7s7k&amp;amp;list=PLeb93j_rsErO182fdoJ4m1p_suKAOcBnM&amp;amp;index=8&quot;&gt;Introducing the Swift SDK for Android&lt;/a&gt; covered the current state of Swift on Android, how to call Java and Kotlin APIs from Swift, UI strategies, and what’s actively being worked on.&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://www.youtube.com/watch?v=EC9qVCYBVyk&amp;amp;list=PLeb93j_rsErO182fdoJ4m1p_suKAOcBnM&amp;amp;index=9&quot;&gt;SwiftCrossUI: Swift apps, everywhere&lt;/a&gt; presented a UI solution for Swift applications that run on Android, Linux, and Windows, using native UI components on each platform. The project also recently published a &lt;a href=&quot;https://www.youtube.com/watch?v=HgRO7eIHkyE&quot;&gt;development update&lt;/a&gt; in video form, covering contributions and recent changes.&lt;/li&gt;
  &lt;li&gt;Ever wanted to control microcontrollers in Swift? &lt;a href=&quot;https://www.youtube.com/watch?v=1ofoMAFq8ak&amp;amp;list=PLeb93j_rsErO182fdoJ4m1p_suKAOcBnM&amp;amp;index=6&quot;&gt;CoreAVR + ArduinoKit: Swift on the Arduino, the Swift way&lt;/a&gt; introduces ArduinoKit, which acts as the Arduino standard library for Swift, and CoreAVR, a hardware abstraction layer for AVR microcontrollers written in Swift.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;community-highlights&quot; class=&quot;header-with-anchor&quot;&gt;Community highlights &lt;a title=&quot;Permalink for Community highlights section&quot; href=&quot;#community-highlights&quot;&gt;
            &lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt; &lt;svg width=&quot;18px&quot; height=&quot;18px&quot; viewBox=&quot;0 0 14 14&quot; role=&quot;img&quot; focusable=&quot;false&quot; aria-hidden=&quot;true&quot; xmlns=&quot;http://www.w3.org/2000/svg&quot;&gt;&lt;path d=&quot;m 11.58824,9.823529 q 0,-0.294117 -0.20589,-0.499999 L 9.85294,7.794118 q -0.20588,-0.205883 -0.5,-0.205883 -0.30882,0 -0.52941,0.235295 0.0221,0.02206 0.13971,0.136029 0.11764,0.113971 0.15808,0.158088 0.0404,0.04412 0.1103,0.139706 0.0698,0.09559 0.0956,0.1875 0.0257,0.09191 0.0257,0.202206 0,0.294117 -0.20588,0.5 -0.20588,0.205882 -0.5,0.205882 -0.1103,0 -0.20221,-0.02573 Q 8.35293,9.301471 8.25733,9.231621 8.16173,9.161771 8.11763,9.121327 8.07353,9.080887 7.95954,8.963238 7.84557,8.845591 7.82351,8.823533 7.58086,9.051474 7.58086,9.360297 q 0,0.294118 0.20588,0.5 l 1.51471,1.522059 q 0.19853,0.19853 0.5,0.19853 0.29412,0 0.5,-0.191177 l 1.08088,-1.073529 q 0.20589,-0.205883 0.20589,-0.492648 z M 6.41912,4.639706 q 0,-0.294118 -0.20588,-0.5 L 4.69853,2.617647 q -0.20588,-0.205882 -0.5,-0.205882 -0.28677,0 -0.5,0.198529 L 2.61765,3.683823 q -0.20589,0.205883 -0.20589,0.492648 0,0.294117 0.20589,0.499999 l 1.52941,1.529412 q 0.19853,0.19853 0.5,0.19853 0.30882,0 0.52941,-0.227942 Q 5.15437,6.15441 5.03676,6.040441 4.91912,5.92647 4.87868,5.882353 4.83828,5.838233 4.76838,5.742647 q -0.0698,-0.09559 -0.0956,-0.1875 -0.0257,-0.09191 -0.0257,-0.202206 0,-0.294117 0.20588,-0.5 0.20588,-0.205882 0.5,-0.205882 0.1103,0 0.20221,0.02573 0.0919,0.02573 0.1875,0.09559 0.0956,0.06985 0.1397,0.110294 0.0441,0.04044 0.15809,0.158089 Q 6.15443,5.154409 6.17649,5.176467 6.41914,4.948526 6.41914,4.639703 z M 13,9.823529 q 0,0.882353 -0.625,1.492647 l -1.08088,1.07353 Q 10.68382,13 9.80147,13 q -0.88971,0 -1.5,-0.625 L 6.78676,10.852941 Q 6.17647,10.242647 6.17647,9.360294 q 0,-0.904412 0.64706,-1.536764 L 6.17647,7.176471 Q 5.54412,7.82353 4.64706,7.82353 q -0.88235,0 -1.5,-0.617648 L 1.617647,5.676471 Q 1,5.058824 1,4.176471 1,3.294118 1.625,2.683824 L 2.70588,1.610294 Q 3.31618,1 4.19853,1 q 0.88971,0 1.5,0.625 l 1.51471,1.522059 q 0.61029,0.610294 0.61029,1.492647 0,0.904412 -0.64706,1.536764 L 7.82353,6.823529 Q 8.45588,6.17647 9.35294,6.17647 q 0.88235,0 1.5,0.617648 l 1.52941,1.529411 Q 13,8.941176 13,9.823529 z&quot;/&gt;&lt;/svg&gt;
          &lt;/a&gt;&lt;/h2&gt;
&lt;ul&gt;
  &lt;li&gt;Swift is participating in Google Summer of Code 2026! 🎉 A recent &lt;a href=&quot;https://forums.swift.org/t/swift-google-summer-of-code-2026/85007&quot;&gt;forums post announced the process&lt;/a&gt; and outlined key dates to learn more. This is a great opportunity if you’re a student interested in contributing to Swift!&lt;/li&gt;
  &lt;li&gt;A community member recently blogged about their experience &lt;a href=&quot;https://compositorapp.com/blog/2026-02-07/Tracy/&quot;&gt;profiling Swift applications on Windows and macOS with Tracy&lt;/a&gt;, covering how to visualize and analyze their application performance.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;swift-evolution&quot; class=&quot;header-with-anchor&quot;&gt;Swift Evolution &lt;a title=&quot;Permalink for Swift Evolution section&quot; href=&quot;#swift-evolution&quot;&gt;
            &lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt; &lt;svg width=&quot;18px&quot; height=&quot;18px&quot; viewBox=&quot;0 0 14 14&quot; role=&quot;img&quot; focusable=&quot;false&quot; aria-hidden=&quot;true&quot; xmlns=&quot;http://www.w3.org/2000/svg&quot;&gt;&lt;path d=&quot;m 11.58824,9.823529 q 0,-0.294117 -0.20589,-0.499999 L 9.85294,7.794118 q -0.20588,-0.205883 -0.5,-0.205883 -0.30882,0 -0.52941,0.235295 0.0221,0.02206 0.13971,0.136029 0.11764,0.113971 0.15808,0.158088 0.0404,0.04412 0.1103,0.139706 0.0698,0.09559 0.0956,0.1875 0.0257,0.09191 0.0257,0.202206 0,0.294117 -0.20588,0.5 -0.20588,0.205882 -0.5,0.205882 -0.1103,0 -0.20221,-0.02573 Q 8.35293,9.301471 8.25733,9.231621 8.16173,9.161771 8.11763,9.121327 8.07353,9.080887 7.95954,8.963238 7.84557,8.845591 7.82351,8.823533 7.58086,9.051474 7.58086,9.360297 q 0,0.294118 0.20588,0.5 l 1.51471,1.522059 q 0.19853,0.19853 0.5,0.19853 0.29412,0 0.5,-0.191177 l 1.08088,-1.073529 q 0.20589,-0.205883 0.20589,-0.492648 z M 6.41912,4.639706 q 0,-0.294118 -0.20588,-0.5 L 4.69853,2.617647 q -0.20588,-0.205882 -0.5,-0.205882 -0.28677,0 -0.5,0.198529 L 2.61765,3.683823 q -0.20589,0.205883 -0.20589,0.492648 0,0.294117 0.20589,0.499999 l 1.52941,1.529412 q 0.19853,0.19853 0.5,0.19853 0.30882,0 0.52941,-0.227942 Q 5.15437,6.15441 5.03676,6.040441 4.91912,5.92647 4.87868,5.882353 4.83828,5.838233 4.76838,5.742647 q -0.0698,-0.09559 -0.0956,-0.1875 -0.0257,-0.09191 -0.0257,-0.202206 0,-0.294117 0.20588,-0.5 0.20588,-0.205882 0.5,-0.205882 0.1103,0 0.20221,0.02573 0.0919,0.02573 0.1875,0.09559 0.0956,0.06985 0.1397,0.110294 0.0441,0.04044 0.15809,0.158089 Q 6.15443,5.154409 6.17649,5.176467 6.41914,4.948526 6.41914,4.639703 z M 13,9.823529 q 0,0.882353 -0.625,1.492647 l -1.08088,1.07353 Q 10.68382,13 9.80147,13 q -0.88971,0 -1.5,-0.625 L 6.78676,10.852941 Q 6.17647,10.242647 6.17647,9.360294 q 0,-0.904412 0.64706,-1.536764 L 6.17647,7.176471 Q 5.54412,7.82353 4.64706,7.82353 q -0.88235,0 -1.5,-0.617648 L 1.617647,5.676471 Q 1,5.058824 1,4.176471 1,3.294118 1.625,2.683824 L 2.70588,1.610294 Q 3.31618,1 4.19853,1 q 0.88971,0 1.5,0.625 l 1.51471,1.522059 q 0.61029,0.610294 0.61029,1.492647 0,0.904412 -0.64706,1.536764 L 7.82353,6.823529 Q 8.45588,6.17647 9.35294,6.17647 q 0.88235,0 1.5,0.617648 l 1.52941,1.529411 Q 13,8.941176 13,9.823529 z&quot;/&gt;&lt;/svg&gt;
          &lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;The Swift project adds new language features through the &lt;a href=&quot;https://www.swift.org/swift-evolution/&quot;&gt;Swift Evolution process&lt;/a&gt;. These are some of the proposals currently under review or recently accepted for a future Swift release.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Under active review:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;&lt;a href=&quot;https://github.com/swiftlang/swift-evolution/blob/main/proposals/0514-hashable-conformance-for-dictionarykeys-collectionofone-emptycollection.md&quot;&gt;SE-0514&lt;/a&gt; Hashable Conformance for &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Dictionary.Keys&lt;/code&gt;, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;CollectionOfOne&lt;/code&gt; and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;EmptyCollection&lt;/code&gt; - Three standard library collection types can’t currently be used in sets or as dictionary keys. This proposal adds &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Hashable&lt;/code&gt; conformance to all three, for consistency with the rest of the standard library.&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://github.com/swiftlang/swift-evolution/blob/main/proposals/0513-commandline-executablepath.md&quot;&gt;SE-0513&lt;/a&gt; API to get the path to the current executable - There’s currently no portable, reliable way to get the path to the currently running executable in Swift. This proposal adds &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;CommandLine.executablePath&lt;/code&gt;, a new property in the standard library that provides a consistent way to get this value across all platforms Swift supports.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Recently accepted:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;&lt;a href=&quot;https://github.com/swiftlang/swift-evolution/blob/main/proposals/0506-advanced-observation-tracking.md&quot;&gt;SE-0506&lt;/a&gt; Advanced Observation Tracking - &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;@Observable&lt;/code&gt; types automatically track when their properties change. However, advanced use cases like developing middleware infrastructure or widget systems require more control and features. This proposal adds options to the existing &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;withObservationTracking&lt;/code&gt; to control when/which changes are observed, and a continuous variant that re-observes automatically after coalesced events.&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://github.com/swiftlang/swift-evolution/blob/main/proposals/0502-exclude-private-from-memberwise-init.md&quot;&gt;SE-0502&lt;/a&gt; Exclude private initialized properties from memberwise initializer - When you define a struct in Swift, the compiler automatically generates an initializer that takes each property as an argument. Currently, adding a private property with a default value to a struct forces that auto-generated initializer to become private, which breaks callers outside of the type. This proposal fixes that behavior.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Have any suggestions for a future issue? Drop them in the &lt;a href=&quot;https://forums.swift.org/c/community-showcase/66&quot;&gt;Community Showcase&lt;/a&gt; on the Swift Forums. See you next time!&lt;/p&gt;
</content>
  </entry>
  
  <entry>
    <title>Announcing Swift System Metrics 1.0: Process-Level Monitoring</title>
    
      
        
        <author>
        
          <name>Vladimir Kukushkin</name>
        
        </author>
      
    
    <link href="https://swift.org/blog/swift-system-metrics-1.0-released/"/>
    <updated>2026-02-20T06:00:00-04:00</updated>
    <id>https://swift.org/blog/swift-system-metrics-1.0-released/</id>
    <content type="html">&lt;p&gt;We are excited to announce the 1.0 release of &lt;a href=&quot;https://github.com/apple/swift-system-metrics&quot;&gt;Swift System Metrics&lt;/a&gt;, a Swift package that collects process-level system metrics like CPU utilization time and memory usage. Swift System Metrics runs on both Linux and macOS, providing a common API across platforms.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/images/system-metrics-1.0/grafana.png&quot; alt=&quot;Swift System Metrics visualized in Grafana, demonstrating what&apos;s possible with real-time monitoring.&quot; title=&quot;Swift System Metrics visualized in Grafana, demonstrating what&apos;s possible with real-time monitoring.&quot; style=&quot;width: 100%;&quot; /&gt;&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;em&gt;Swift System Metrics visualized in Grafana, demonstrating what&apos;s possible with real-time monitoring.&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;&lt;/p&gt;

&lt;p&gt;Monitoring process metrics enables you to detect performance issues, optimize resource usage, and ensure your service remains reliable and cost-effective under varying loads. You can integrate Swift System Metrics into your service in just a few lines of code, making observability accessible to every developer and ensuring that even the smallest services can have production-grade visibility from day one.&lt;/p&gt;

&lt;p&gt;Swift System Metrics is part of a larger set of packages that provide an end-to-end solution for integrating metrics into your Swift applications and services. Once system metrics are collected, they’re reported to &lt;a href=&quot;https://github.com/apple/swift-metrics&quot;&gt;Swift Metrics&lt;/a&gt;, a backend-agnostic metrics API that can work with popular backends like Prometheus and OpenTelemetry. Swift System Metrics also leverages &lt;a href=&quot;https://github.com/swift-server/swift-service-lifecycle&quot;&gt;Swift Service Lifecycle&lt;/a&gt; to handle process bootstrapping and resource cleanup.&lt;/p&gt;

&lt;p&gt;With the 1.0 milestone, the API is now stable and ready for use. Note that this package was previously &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;swift-metrics-extras&lt;/code&gt;, and renamed to better reflect its purpose.&lt;/p&gt;

&lt;h2 id=&quot;highlights&quot; class=&quot;header-with-anchor&quot;&gt;Highlights &lt;a title=&quot;Permalink for Highlights section&quot; href=&quot;#highlights&quot;&gt;
            &lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt; &lt;svg width=&quot;18px&quot; height=&quot;18px&quot; viewBox=&quot;0 0 14 14&quot; role=&quot;img&quot; focusable=&quot;false&quot; aria-hidden=&quot;true&quot; xmlns=&quot;http://www.w3.org/2000/svg&quot;&gt;&lt;path d=&quot;m 11.58824,9.823529 q 0,-0.294117 -0.20589,-0.499999 L 9.85294,7.794118 q -0.20588,-0.205883 -0.5,-0.205883 -0.30882,0 -0.52941,0.235295 0.0221,0.02206 0.13971,0.136029 0.11764,0.113971 0.15808,0.158088 0.0404,0.04412 0.1103,0.139706 0.0698,0.09559 0.0956,0.1875 0.0257,0.09191 0.0257,0.202206 0,0.294117 -0.20588,0.5 -0.20588,0.205882 -0.5,0.205882 -0.1103,0 -0.20221,-0.02573 Q 8.35293,9.301471 8.25733,9.231621 8.16173,9.161771 8.11763,9.121327 8.07353,9.080887 7.95954,8.963238 7.84557,8.845591 7.82351,8.823533 7.58086,9.051474 7.58086,9.360297 q 0,0.294118 0.20588,0.5 l 1.51471,1.522059 q 0.19853,0.19853 0.5,0.19853 0.29412,0 0.5,-0.191177 l 1.08088,-1.073529 q 0.20589,-0.205883 0.20589,-0.492648 z M 6.41912,4.639706 q 0,-0.294118 -0.20588,-0.5 L 4.69853,2.617647 q -0.20588,-0.205882 -0.5,-0.205882 -0.28677,0 -0.5,0.198529 L 2.61765,3.683823 q -0.20589,0.205883 -0.20589,0.492648 0,0.294117 0.20589,0.499999 l 1.52941,1.529412 q 0.19853,0.19853 0.5,0.19853 0.30882,0 0.52941,-0.227942 Q 5.15437,6.15441 5.03676,6.040441 4.91912,5.92647 4.87868,5.882353 4.83828,5.838233 4.76838,5.742647 q -0.0698,-0.09559 -0.0956,-0.1875 -0.0257,-0.09191 -0.0257,-0.202206 0,-0.294117 0.20588,-0.5 0.20588,-0.205882 0.5,-0.205882 0.1103,0 0.20221,0.02573 0.0919,0.02573 0.1875,0.09559 0.0956,0.06985 0.1397,0.110294 0.0441,0.04044 0.15809,0.158089 Q 6.15443,5.154409 6.17649,5.176467 6.41914,4.948526 6.41914,4.639703 z M 13,9.823529 q 0,0.882353 -0.625,1.492647 l -1.08088,1.07353 Q 10.68382,13 9.80147,13 q -0.88971,0 -1.5,-0.625 L 6.78676,10.852941 Q 6.17647,10.242647 6.17647,9.360294 q 0,-0.904412 0.64706,-1.536764 L 6.17647,7.176471 Q 5.54412,7.82353 4.64706,7.82353 q -0.88235,0 -1.5,-0.617648 L 1.617647,5.676471 Q 1,5.058824 1,4.176471 1,3.294118 1.625,2.683824 L 2.70588,1.610294 Q 3.31618,1 4.19853,1 q 0.88971,0 1.5,0.625 l 1.51471,1.522059 q 0.61029,0.610294 0.61029,1.492647 0,0.904412 -0.64706,1.536764 L 7.82353,6.823529 Q 8.45588,6.17647 9.35294,6.17647 q 0.88235,0 1.5,0.617648 l 1.52941,1.529411 Q 13,8.941176 13,9.823529 z&quot;/&gt;&lt;/svg&gt;
          &lt;/a&gt;&lt;/h2&gt;

&lt;ul&gt;
  &lt;li&gt;Collects and reports:
    &lt;ul&gt;
      &lt;li&gt;CPU utilization time&lt;/li&gt;
      &lt;li&gt;Virtual and resident memory usage&lt;/li&gt;
      &lt;li&gt;Open and maximum available file descriptors&lt;/li&gt;
      &lt;li&gt;Process start time&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;API-stable public interface&lt;/li&gt;
  &lt;li&gt;Support on both Linux and macOS&lt;/li&gt;
  &lt;li&gt;musl libc compatibility&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The package includes an &lt;a href=&quot;https://github.com/apple/swift-system-metrics/blob/main/Examples/ServiceIntegration/grafana/provisioning/dashboards/grafana-dashboard-service-process-metrics.json&quot;&gt;example Grafana dashboard configuration&lt;/a&gt; to start visualizing metrics immediately.&lt;/p&gt;

&lt;h2 id=&quot;get-started&quot; class=&quot;header-with-anchor&quot;&gt;Get Started &lt;a title=&quot;Permalink for Get Started section&quot; href=&quot;#get-started&quot;&gt;
            &lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt; &lt;svg width=&quot;18px&quot; height=&quot;18px&quot; viewBox=&quot;0 0 14 14&quot; role=&quot;img&quot; focusable=&quot;false&quot; aria-hidden=&quot;true&quot; xmlns=&quot;http://www.w3.org/2000/svg&quot;&gt;&lt;path d=&quot;m 11.58824,9.823529 q 0,-0.294117 -0.20589,-0.499999 L 9.85294,7.794118 q -0.20588,-0.205883 -0.5,-0.205883 -0.30882,0 -0.52941,0.235295 0.0221,0.02206 0.13971,0.136029 0.11764,0.113971 0.15808,0.158088 0.0404,0.04412 0.1103,0.139706 0.0698,0.09559 0.0956,0.1875 0.0257,0.09191 0.0257,0.202206 0,0.294117 -0.20588,0.5 -0.20588,0.205882 -0.5,0.205882 -0.1103,0 -0.20221,-0.02573 Q 8.35293,9.301471 8.25733,9.231621 8.16173,9.161771 8.11763,9.121327 8.07353,9.080887 7.95954,8.963238 7.84557,8.845591 7.82351,8.823533 7.58086,9.051474 7.58086,9.360297 q 0,0.294118 0.20588,0.5 l 1.51471,1.522059 q 0.19853,0.19853 0.5,0.19853 0.29412,0 0.5,-0.191177 l 1.08088,-1.073529 q 0.20589,-0.205883 0.20589,-0.492648 z M 6.41912,4.639706 q 0,-0.294118 -0.20588,-0.5 L 4.69853,2.617647 q -0.20588,-0.205882 -0.5,-0.205882 -0.28677,0 -0.5,0.198529 L 2.61765,3.683823 q -0.20589,0.205883 -0.20589,0.492648 0,0.294117 0.20589,0.499999 l 1.52941,1.529412 q 0.19853,0.19853 0.5,0.19853 0.30882,0 0.52941,-0.227942 Q 5.15437,6.15441 5.03676,6.040441 4.91912,5.92647 4.87868,5.882353 4.83828,5.838233 4.76838,5.742647 q -0.0698,-0.09559 -0.0956,-0.1875 -0.0257,-0.09191 -0.0257,-0.202206 0,-0.294117 0.20588,-0.5 0.20588,-0.205882 0.5,-0.205882 0.1103,0 0.20221,0.02573 0.0919,0.02573 0.1875,0.09559 0.0956,0.06985 0.1397,0.110294 0.0441,0.04044 0.15809,0.158089 Q 6.15443,5.154409 6.17649,5.176467 6.41914,4.948526 6.41914,4.639703 z M 13,9.823529 q 0,0.882353 -0.625,1.492647 l -1.08088,1.07353 Q 10.68382,13 9.80147,13 q -0.88971,0 -1.5,-0.625 L 6.78676,10.852941 Q 6.17647,10.242647 6.17647,9.360294 q 0,-0.904412 0.64706,-1.536764 L 6.17647,7.176471 Q 5.54412,7.82353 4.64706,7.82353 q -0.88235,0 -1.5,-0.617648 L 1.617647,5.676471 Q 1,5.058824 1,4.176471 1,3.294118 1.625,2.683824 L 2.70588,1.610294 Q 3.31618,1 4.19853,1 q 0.88971,0 1.5,0.625 l 1.51471,1.522059 q 0.61029,0.610294 0.61029,1.492647 0,0.904412 -0.64706,1.536764 L 7.82353,6.823529 Q 8.45588,6.17647 9.35294,6.17647 q 0.88235,0 1.5,0.617648 l 1.52941,1.529411 Q 13,8.941176 13,9.823529 z&quot;/&gt;&lt;/svg&gt;
          &lt;/a&gt;&lt;/h2&gt;

&lt;p&gt;Add the dependency to your &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Package.swift&lt;/code&gt;:&lt;/p&gt;

&lt;div class=&quot;language-swift highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;package&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;url&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;https://github.com/apple/swift-system-metrics&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;from&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;1.0.0&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Add the library dependency to your target:&lt;/p&gt;

&lt;div class=&quot;language-swift highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;product&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;SystemMetrics&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;package&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;swift-system-metrics&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Import and use in your code:&lt;/p&gt;

&lt;div class=&quot;language-swift highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;kd&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;SystemMetrics&lt;/span&gt;
&lt;span class=&quot;kd&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;ServiceLifecycle&lt;/span&gt;
&lt;span class=&quot;kd&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;Logging&lt;/span&gt;
&lt;span class=&quot;kd&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;OTel&lt;/span&gt;

&lt;span class=&quot;kd&quot;&gt;@main&lt;/span&gt;
&lt;span class=&quot;kd&quot;&gt;struct&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;Application&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
  &lt;span class=&quot;kd&quot;&gt;static&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;func&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;main&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;async&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;throws&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;c1&quot;&gt;// Create a logger, or use one of the existing loggers&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;let&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;logger&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;Logger&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;label&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;Application&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;

    &lt;span class=&quot;c1&quot;&gt;// Setup MetricsSystem, for example using swift-otel&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;otelConfig&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;OTel&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;Configuration&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;default&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;otelConfig&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;serviceName&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;Application&quot;&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;let&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;otelService&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;try&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;OTel&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;bootstrap&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;configuration&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;otelConfig&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;

    &lt;span class=&quot;c1&quot;&gt;// Setup your service&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;let&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;service&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;FooService&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;

    &lt;span class=&quot;c1&quot;&gt;// Create the monitor&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;let&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;systemMetricsMonitor&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;SystemMetricsMonitor&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;logger&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;logger&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;

    &lt;span class=&quot;c1&quot;&gt;// Create the service&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;let&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;serviceGroup&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;ServiceGroup&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;
      &lt;span class=&quot;nv&quot;&gt;services&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;otelService&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;service&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;systemMetricsMonitor&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;],&lt;/span&gt;
      &lt;span class=&quot;nv&quot;&gt;gracefulShutdownSignals&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;sigint&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;],&lt;/span&gt;
      &lt;span class=&quot;nv&quot;&gt;cancellationSignals&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;sigterm&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;],&lt;/span&gt;
      &lt;span class=&quot;nv&quot;&gt;logger&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;logger&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;

    &lt;span class=&quot;k&quot;&gt;try&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;await&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;serviceGroup&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;run&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;The complete documentation is available on &lt;a href=&quot;https://swiftpackageindex.com/apple/swift-system-metrics/documentation&quot;&gt;Swift Package Index&lt;/a&gt;.&lt;/p&gt;

&lt;h2 id=&quot;get-involved&quot; class=&quot;header-with-anchor&quot;&gt;Get Involved &lt;a title=&quot;Permalink for Get Involved section&quot; href=&quot;#get-involved&quot;&gt;
            &lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt; &lt;svg width=&quot;18px&quot; height=&quot;18px&quot; viewBox=&quot;0 0 14 14&quot; role=&quot;img&quot; focusable=&quot;false&quot; aria-hidden=&quot;true&quot; xmlns=&quot;http://www.w3.org/2000/svg&quot;&gt;&lt;path d=&quot;m 11.58824,9.823529 q 0,-0.294117 -0.20589,-0.499999 L 9.85294,7.794118 q -0.20588,-0.205883 -0.5,-0.205883 -0.30882,0 -0.52941,0.235295 0.0221,0.02206 0.13971,0.136029 0.11764,0.113971 0.15808,0.158088 0.0404,0.04412 0.1103,0.139706 0.0698,0.09559 0.0956,0.1875 0.0257,0.09191 0.0257,0.202206 0,0.294117 -0.20588,0.5 -0.20588,0.205882 -0.5,0.205882 -0.1103,0 -0.20221,-0.02573 Q 8.35293,9.301471 8.25733,9.231621 8.16173,9.161771 8.11763,9.121327 8.07353,9.080887 7.95954,8.963238 7.84557,8.845591 7.82351,8.823533 7.58086,9.051474 7.58086,9.360297 q 0,0.294118 0.20588,0.5 l 1.51471,1.522059 q 0.19853,0.19853 0.5,0.19853 0.29412,0 0.5,-0.191177 l 1.08088,-1.073529 q 0.20589,-0.205883 0.20589,-0.492648 z M 6.41912,4.639706 q 0,-0.294118 -0.20588,-0.5 L 4.69853,2.617647 q -0.20588,-0.205882 -0.5,-0.205882 -0.28677,0 -0.5,0.198529 L 2.61765,3.683823 q -0.20589,0.205883 -0.20589,0.492648 0,0.294117 0.20589,0.499999 l 1.52941,1.529412 q 0.19853,0.19853 0.5,0.19853 0.30882,0 0.52941,-0.227942 Q 5.15437,6.15441 5.03676,6.040441 4.91912,5.92647 4.87868,5.882353 4.83828,5.838233 4.76838,5.742647 q -0.0698,-0.09559 -0.0956,-0.1875 -0.0257,-0.09191 -0.0257,-0.202206 0,-0.294117 0.20588,-0.5 0.20588,-0.205882 0.5,-0.205882 0.1103,0 0.20221,0.02573 0.0919,0.02573 0.1875,0.09559 0.0956,0.06985 0.1397,0.110294 0.0441,0.04044 0.15809,0.158089 Q 6.15443,5.154409 6.17649,5.176467 6.41914,4.948526 6.41914,4.639703 z M 13,9.823529 q 0,0.882353 -0.625,1.492647 l -1.08088,1.07353 Q 10.68382,13 9.80147,13 q -0.88971,0 -1.5,-0.625 L 6.78676,10.852941 Q 6.17647,10.242647 6.17647,9.360294 q 0,-0.904412 0.64706,-1.536764 L 6.17647,7.176471 Q 5.54412,7.82353 4.64706,7.82353 q -0.88235,0 -1.5,-0.617648 L 1.617647,5.676471 Q 1,5.058824 1,4.176471 1,3.294118 1.625,2.683824 L 2.70588,1.610294 Q 3.31618,1 4.19853,1 q 0.88971,0 1.5,0.625 l 1.51471,1.522059 q 0.61029,0.610294 0.61029,1.492647 0,0.904412 -0.64706,1.536764 L 7.82353,6.823529 Q 8.45588,6.17647 9.35294,6.17647 q 0.88235,0 1.5,0.617648 l 1.52941,1.529411 Q 13,8.941176 13,9.823529 z&quot;/&gt;&lt;/svg&gt;
          &lt;/a&gt;&lt;/h2&gt;

&lt;p&gt;We’re looking for contributions to grow the list of process metrics collected and to expand platform support. PRs are welcome - our &lt;a href=&quot;https://github.com/apple/swift-system-metrics/blob/main/CONTRIBUTING.md&quot;&gt;contribution guidelines&lt;/a&gt; describe how to get started.&lt;/p&gt;

&lt;p&gt;By reaching 1.0, this project will maintain a backwards-compatible API as it continues to evolve. Thanks to everyone who contributed to this release.&lt;/p&gt;
</content>
  </entry>
  
  <entry>
    <title>What's new in Swift: January 2026 Edition</title>
    
      
        
        <author>
        
          <name>Nick Sloan</name>
        
        </author>
      
        
        <author>
        
          <name>Dave Lester</name>
        
        </author>
      
    
    <link href="https://swift.org/blog/whats-new-in-swift-january-2026/"/>
    <updated>2026-01-30T11:15:00-04:00</updated>
    <id>https://swift.org/blog/whats-new-in-swift-january-2026/</id>
    <content type="html">&lt;p&gt;A &lt;a href=&quot;https://www.reddit.com/r/swift/comments/1qhhiod/&quot;&gt;Reddit thread&lt;/a&gt; earlier this month asked about building web apps with Swift. For this edition of “What’s new in Swift,” we invited a developer to share their experience:&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;Hi, I’m Nick Sloan. I’m the head of engineering at &lt;a href=&quot;https://studioworks.app/&quot;&gt;Studioworks&lt;/a&gt;, a platform that makes it easy and fun to run your creative studio, agency or freelance business.&lt;/p&gt;

  &lt;p&gt;We chose Swift for Studioworks because of how easy it is to write safe and reliable code with great performance. Our Swift project makes use of &lt;a href=&quot;https://hummingbird.codes&quot;&gt;Hummingbird 2&lt;/a&gt;, &lt;a href=&quot;https://soto.codes/&quot;&gt;Soto&lt;/a&gt; (for its incredible DynamoDB Codable support), &lt;a href=&quot;https://github.com/sloatescoan/hummingbird-macrorouting/&quot;&gt;Hummingbird MacroRouting&lt;/a&gt;, and &lt;a href=&quot;https://github.com/elementary-swift/elementary&quot;&gt;Elementary&lt;/a&gt;. Studioworks is a big and growing project. We are the largest Elementary codebase, and I suspect we are among the biggest projects using Hummingbird as well.&lt;/p&gt;

  &lt;p&gt;We’ve already processed millions of dollars in invoices for our customers, and after 20 years of shipping web applications, I have never seen fewer crashes and bugs make it to production. Performance has also been excellent, especially after moving our templates to Elementary. Our heaviest pages make it to the browser in less than 100ms.&lt;/p&gt;

  &lt;p&gt;We’ve been deploying web applications with PHP and Python for decades, and getting started with a Swift web project was certainly a bit slower. We had to recreate some of the build, deployment and chat tooling we had been relying on in our Python projects for years, and it took us a bit of experimenting to realize that Elementary was the best choice for templating. Once we got past those hurdles we’ve been able to build about as fast as we ever did with Python, and the quality is much better.&lt;/p&gt;

  &lt;p&gt;Swift on the web has been a resounding success for us, and I hope we’ll see this part of the community continue to grow!&lt;/p&gt;

  &lt;p&gt;— Nick Sloan&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Learn more about Swift on Linux and server-based use cases by checking out our &lt;a href=&quot;/blog/whats-new-in-swift-october-2025/&quot;&gt;October edition&lt;/a&gt;, which featured highlights from the Server-Side Swift Conference. The swift.org website also has a use case page dedicated to &lt;a href=&quot;/get-started/cloud-services/&quot;&gt;cloud services&lt;/a&gt;, including a &lt;a href=&quot;https://docs.swift.org/getting-started-swift-server/tutorials/getting-started-swift-server/&quot;&gt;tutorial&lt;/a&gt; to get started.&lt;/p&gt;

&lt;p&gt;And now for what’s new in Swift this month.&lt;/p&gt;

&lt;h2 id=&quot;videos-to-watch&quot; class=&quot;header-with-anchor&quot;&gt;Videos to watch &lt;a title=&quot;Permalink for Videos to watch section&quot; href=&quot;#videos-to-watch&quot;&gt;
            &lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt; &lt;svg width=&quot;18px&quot; height=&quot;18px&quot; viewBox=&quot;0 0 14 14&quot; role=&quot;img&quot; focusable=&quot;false&quot; aria-hidden=&quot;true&quot; xmlns=&quot;http://www.w3.org/2000/svg&quot;&gt;&lt;path d=&quot;m 11.58824,9.823529 q 0,-0.294117 -0.20589,-0.499999 L 9.85294,7.794118 q -0.20588,-0.205883 -0.5,-0.205883 -0.30882,0 -0.52941,0.235295 0.0221,0.02206 0.13971,0.136029 0.11764,0.113971 0.15808,0.158088 0.0404,0.04412 0.1103,0.139706 0.0698,0.09559 0.0956,0.1875 0.0257,0.09191 0.0257,0.202206 0,0.294117 -0.20588,0.5 -0.20588,0.205882 -0.5,0.205882 -0.1103,0 -0.20221,-0.02573 Q 8.35293,9.301471 8.25733,9.231621 8.16173,9.161771 8.11763,9.121327 8.07353,9.080887 7.95954,8.963238 7.84557,8.845591 7.82351,8.823533 7.58086,9.051474 7.58086,9.360297 q 0,0.294118 0.20588,0.5 l 1.51471,1.522059 q 0.19853,0.19853 0.5,0.19853 0.29412,0 0.5,-0.191177 l 1.08088,-1.073529 q 0.20589,-0.205883 0.20589,-0.492648 z M 6.41912,4.639706 q 0,-0.294118 -0.20588,-0.5 L 4.69853,2.617647 q -0.20588,-0.205882 -0.5,-0.205882 -0.28677,0 -0.5,0.198529 L 2.61765,3.683823 q -0.20589,0.205883 -0.20589,0.492648 0,0.294117 0.20589,0.499999 l 1.52941,1.529412 q 0.19853,0.19853 0.5,0.19853 0.30882,0 0.52941,-0.227942 Q 5.15437,6.15441 5.03676,6.040441 4.91912,5.92647 4.87868,5.882353 4.83828,5.838233 4.76838,5.742647 q -0.0698,-0.09559 -0.0956,-0.1875 -0.0257,-0.09191 -0.0257,-0.202206 0,-0.294117 0.20588,-0.5 0.20588,-0.205882 0.5,-0.205882 0.1103,0 0.20221,0.02573 0.0919,0.02573 0.1875,0.09559 0.0956,0.06985 0.1397,0.110294 0.0441,0.04044 0.15809,0.158089 Q 6.15443,5.154409 6.17649,5.176467 6.41914,4.948526 6.41914,4.639703 z M 13,9.823529 q 0,0.882353 -0.625,1.492647 l -1.08088,1.07353 Q 10.68382,13 9.80147,13 q -0.88971,0 -1.5,-0.625 L 6.78676,10.852941 Q 6.17647,10.242647 6.17647,9.360294 q 0,-0.904412 0.64706,-1.536764 L 6.17647,7.176471 Q 5.54412,7.82353 4.64706,7.82353 q -0.88235,0 -1.5,-0.617648 L 1.617647,5.676471 Q 1,5.058824 1,4.176471 1,3.294118 1.625,2.683824 L 2.70588,1.610294 Q 3.31618,1 4.19853,1 q 0.88971,0 1.5,0.625 l 1.51471,1.522059 q 0.61029,0.610294 0.61029,1.492647 0,0.904412 -0.64706,1.536764 L 7.82353,6.823529 Q 8.45588,6.17647 9.35294,6.17647 q 0.88235,0 1.5,0.617648 l 1.52941,1.529411 Q 13,8.941176 13,9.823529 z&quot;/&gt;&lt;/svg&gt;
          &lt;/a&gt;&lt;/h2&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;a href=&quot;https://www.youtube.com/watch?v=opqKGgJavkw&quot;&gt;On Progressive Disclosure in Swift&lt;/a&gt; - Doug Gregor’s must-watch talk explores how Swift lets you progressively use more language features as your experience and codebase evolves.&lt;/li&gt;
  &lt;li&gt;A new episode of NSScreencast dives into livecoding the &lt;a href=&quot;https://nsscreencast.com/episodes/604-brc-part1&quot;&gt;Billion Row Challenge&lt;/a&gt;, with Matt Massicotte as a guest.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;new-package-releases&quot; class=&quot;header-with-anchor&quot;&gt;New package releases &lt;a title=&quot;Permalink for New package releases section&quot; href=&quot;#new-package-releases&quot;&gt;
            &lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt; &lt;svg width=&quot;18px&quot; height=&quot;18px&quot; viewBox=&quot;0 0 14 14&quot; role=&quot;img&quot; focusable=&quot;false&quot; aria-hidden=&quot;true&quot; xmlns=&quot;http://www.w3.org/2000/svg&quot;&gt;&lt;path d=&quot;m 11.58824,9.823529 q 0,-0.294117 -0.20589,-0.499999 L 9.85294,7.794118 q -0.20588,-0.205883 -0.5,-0.205883 -0.30882,0 -0.52941,0.235295 0.0221,0.02206 0.13971,0.136029 0.11764,0.113971 0.15808,0.158088 0.0404,0.04412 0.1103,0.139706 0.0698,0.09559 0.0956,0.1875 0.0257,0.09191 0.0257,0.202206 0,0.294117 -0.20588,0.5 -0.20588,0.205882 -0.5,0.205882 -0.1103,0 -0.20221,-0.02573 Q 8.35293,9.301471 8.25733,9.231621 8.16173,9.161771 8.11763,9.121327 8.07353,9.080887 7.95954,8.963238 7.84557,8.845591 7.82351,8.823533 7.58086,9.051474 7.58086,9.360297 q 0,0.294118 0.20588,0.5 l 1.51471,1.522059 q 0.19853,0.19853 0.5,0.19853 0.29412,0 0.5,-0.191177 l 1.08088,-1.073529 q 0.20589,-0.205883 0.20589,-0.492648 z M 6.41912,4.639706 q 0,-0.294118 -0.20588,-0.5 L 4.69853,2.617647 q -0.20588,-0.205882 -0.5,-0.205882 -0.28677,0 -0.5,0.198529 L 2.61765,3.683823 q -0.20589,0.205883 -0.20589,0.492648 0,0.294117 0.20589,0.499999 l 1.52941,1.529412 q 0.19853,0.19853 0.5,0.19853 0.30882,0 0.52941,-0.227942 Q 5.15437,6.15441 5.03676,6.040441 4.91912,5.92647 4.87868,5.882353 4.83828,5.838233 4.76838,5.742647 q -0.0698,-0.09559 -0.0956,-0.1875 -0.0257,-0.09191 -0.0257,-0.202206 0,-0.294117 0.20588,-0.5 0.20588,-0.205882 0.5,-0.205882 0.1103,0 0.20221,0.02573 0.0919,0.02573 0.1875,0.09559 0.0956,0.06985 0.1397,0.110294 0.0441,0.04044 0.15809,0.158089 Q 6.15443,5.154409 6.17649,5.176467 6.41914,4.948526 6.41914,4.639703 z M 13,9.823529 q 0,0.882353 -0.625,1.492647 l -1.08088,1.07353 Q 10.68382,13 9.80147,13 q -0.88971,0 -1.5,-0.625 L 6.78676,10.852941 Q 6.17647,10.242647 6.17647,9.360294 q 0,-0.904412 0.64706,-1.536764 L 6.17647,7.176471 Q 5.54412,7.82353 4.64706,7.82353 q -0.88235,0 -1.5,-0.617648 L 1.617647,5.676471 Q 1,5.058824 1,4.176471 1,3.294118 1.625,2.683824 L 2.70588,1.610294 Q 3.31618,1 4.19853,1 q 0.88971,0 1.5,0.625 l 1.51471,1.522059 q 0.61029,0.610294 0.61029,1.492647 0,0.904412 -0.64706,1.536764 L 7.82353,6.823529 Q 8.45588,6.17647 9.35294,6.17647 q 0.88235,0 1.5,0.617648 l 1.52941,1.529411 Q 13,8.941176 13,9.823529 z&quot;/&gt;&lt;/svg&gt;
          &lt;/a&gt;&lt;/h2&gt;
&lt;ul&gt;
  &lt;li&gt;Want to build 3D models with code? &lt;a href=&quot;https://github.com/tomasf/Cadova&quot;&gt;Cadova&lt;/a&gt; is a programmable alternative to traditional CAD tools, with a focus on 3D printing.&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://github.com/feather-framework/feather-database&quot;&gt;Feather Database&lt;/a&gt; provides a database-agnostic layer that can be shared by multiple database drivers. And it’s designed for modern Swift concurrency.&lt;/li&gt;
  &lt;li&gt;Miguel de Icaza has ported the .NET Foundation mail stack, originally created by Jeffrey Stedfast (MailKit/MimeKit), to Swift. Hello &lt;a href=&quot;https://github.com/migueldeicaza/MailFoundation&quot;&gt;MailFoundation&lt;/a&gt; and &lt;a href=&quot;https://github.com/migueldeicaza/MimeFoundation&quot;&gt;MimeFoundation&lt;/a&gt;!&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;community-highlights&quot; class=&quot;header-with-anchor&quot;&gt;Community highlights &lt;a title=&quot;Permalink for Community highlights section&quot; href=&quot;#community-highlights&quot;&gt;
            &lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt; &lt;svg width=&quot;18px&quot; height=&quot;18px&quot; viewBox=&quot;0 0 14 14&quot; role=&quot;img&quot; focusable=&quot;false&quot; aria-hidden=&quot;true&quot; xmlns=&quot;http://www.w3.org/2000/svg&quot;&gt;&lt;path d=&quot;m 11.58824,9.823529 q 0,-0.294117 -0.20589,-0.499999 L 9.85294,7.794118 q -0.20588,-0.205883 -0.5,-0.205883 -0.30882,0 -0.52941,0.235295 0.0221,0.02206 0.13971,0.136029 0.11764,0.113971 0.15808,0.158088 0.0404,0.04412 0.1103,0.139706 0.0698,0.09559 0.0956,0.1875 0.0257,0.09191 0.0257,0.202206 0,0.294117 -0.20588,0.5 -0.20588,0.205882 -0.5,0.205882 -0.1103,0 -0.20221,-0.02573 Q 8.35293,9.301471 8.25733,9.231621 8.16173,9.161771 8.11763,9.121327 8.07353,9.080887 7.95954,8.963238 7.84557,8.845591 7.82351,8.823533 7.58086,9.051474 7.58086,9.360297 q 0,0.294118 0.20588,0.5 l 1.51471,1.522059 q 0.19853,0.19853 0.5,0.19853 0.29412,0 0.5,-0.191177 l 1.08088,-1.073529 q 0.20589,-0.205883 0.20589,-0.492648 z M 6.41912,4.639706 q 0,-0.294118 -0.20588,-0.5 L 4.69853,2.617647 q -0.20588,-0.205882 -0.5,-0.205882 -0.28677,0 -0.5,0.198529 L 2.61765,3.683823 q -0.20589,0.205883 -0.20589,0.492648 0,0.294117 0.20589,0.499999 l 1.52941,1.529412 q 0.19853,0.19853 0.5,0.19853 0.30882,0 0.52941,-0.227942 Q 5.15437,6.15441 5.03676,6.040441 4.91912,5.92647 4.87868,5.882353 4.83828,5.838233 4.76838,5.742647 q -0.0698,-0.09559 -0.0956,-0.1875 -0.0257,-0.09191 -0.0257,-0.202206 0,-0.294117 0.20588,-0.5 0.20588,-0.205882 0.5,-0.205882 0.1103,0 0.20221,0.02573 0.0919,0.02573 0.1875,0.09559 0.0956,0.06985 0.1397,0.110294 0.0441,0.04044 0.15809,0.158089 Q 6.15443,5.154409 6.17649,5.176467 6.41914,4.948526 6.41914,4.639703 z M 13,9.823529 q 0,0.882353 -0.625,1.492647 l -1.08088,1.07353 Q 10.68382,13 9.80147,13 q -0.88971,0 -1.5,-0.625 L 6.78676,10.852941 Q 6.17647,10.242647 6.17647,9.360294 q 0,-0.904412 0.64706,-1.536764 L 6.17647,7.176471 Q 5.54412,7.82353 4.64706,7.82353 q -0.88235,0 -1.5,-0.617648 L 1.617647,5.676471 Q 1,5.058824 1,4.176471 1,3.294118 1.625,2.683824 L 2.70588,1.610294 Q 3.31618,1 4.19853,1 q 0.88971,0 1.5,0.625 l 1.51471,1.522059 q 0.61029,0.610294 0.61029,1.492647 0,0.904412 -0.64706,1.536764 L 7.82353,6.823529 Q 8.45588,6.17647 9.35294,6.17647 q 0.88235,0 1.5,0.617648 l 1.52941,1.529411 Q 13,8.941176 13,9.823529 z&quot;/&gt;&lt;/svg&gt;
          &lt;/a&gt;&lt;/h2&gt;
&lt;ul&gt;
  &lt;li&gt;&lt;a href=&quot;https://xtremekforever.substack.com/p/introduction-to-building-swift-for&quot;&gt;Introduction to Building Swift for Yocto&lt;/a&gt; - Check out this embedded Linux guide to using meta-swift to build Swift for a Raspberry Pi Zero 2.&lt;/li&gt;
  &lt;li&gt;Registration is open for several Swift community conferences, including &lt;a href=&quot;https://swiftcraft.uk&quot;&gt;SwiftCraft&lt;/a&gt; and &lt;a href=&quot;https://tryswift.jp/en/&quot;&gt;try! Swift Tokyo&lt;/a&gt;. The Call for Proposals (CFP) is still open for try! Swift Tokyo.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;swift-evolution&quot; class=&quot;header-with-anchor&quot;&gt;Swift Evolution &lt;a title=&quot;Permalink for Swift Evolution section&quot; href=&quot;#swift-evolution&quot;&gt;
            &lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt; &lt;svg width=&quot;18px&quot; height=&quot;18px&quot; viewBox=&quot;0 0 14 14&quot; role=&quot;img&quot; focusable=&quot;false&quot; aria-hidden=&quot;true&quot; xmlns=&quot;http://www.w3.org/2000/svg&quot;&gt;&lt;path d=&quot;m 11.58824,9.823529 q 0,-0.294117 -0.20589,-0.499999 L 9.85294,7.794118 q -0.20588,-0.205883 -0.5,-0.205883 -0.30882,0 -0.52941,0.235295 0.0221,0.02206 0.13971,0.136029 0.11764,0.113971 0.15808,0.158088 0.0404,0.04412 0.1103,0.139706 0.0698,0.09559 0.0956,0.1875 0.0257,0.09191 0.0257,0.202206 0,0.294117 -0.20588,0.5 -0.20588,0.205882 -0.5,0.205882 -0.1103,0 -0.20221,-0.02573 Q 8.35293,9.301471 8.25733,9.231621 8.16173,9.161771 8.11763,9.121327 8.07353,9.080887 7.95954,8.963238 7.84557,8.845591 7.82351,8.823533 7.58086,9.051474 7.58086,9.360297 q 0,0.294118 0.20588,0.5 l 1.51471,1.522059 q 0.19853,0.19853 0.5,0.19853 0.29412,0 0.5,-0.191177 l 1.08088,-1.073529 q 0.20589,-0.205883 0.20589,-0.492648 z M 6.41912,4.639706 q 0,-0.294118 -0.20588,-0.5 L 4.69853,2.617647 q -0.20588,-0.205882 -0.5,-0.205882 -0.28677,0 -0.5,0.198529 L 2.61765,3.683823 q -0.20589,0.205883 -0.20589,0.492648 0,0.294117 0.20589,0.499999 l 1.52941,1.529412 q 0.19853,0.19853 0.5,0.19853 0.30882,0 0.52941,-0.227942 Q 5.15437,6.15441 5.03676,6.040441 4.91912,5.92647 4.87868,5.882353 4.83828,5.838233 4.76838,5.742647 q -0.0698,-0.09559 -0.0956,-0.1875 -0.0257,-0.09191 -0.0257,-0.202206 0,-0.294117 0.20588,-0.5 0.20588,-0.205882 0.5,-0.205882 0.1103,0 0.20221,0.02573 0.0919,0.02573 0.1875,0.09559 0.0956,0.06985 0.1397,0.110294 0.0441,0.04044 0.15809,0.158089 Q 6.15443,5.154409 6.17649,5.176467 6.41914,4.948526 6.41914,4.639703 z M 13,9.823529 q 0,0.882353 -0.625,1.492647 l -1.08088,1.07353 Q 10.68382,13 9.80147,13 q -0.88971,0 -1.5,-0.625 L 6.78676,10.852941 Q 6.17647,10.242647 6.17647,9.360294 q 0,-0.904412 0.64706,-1.536764 L 6.17647,7.176471 Q 5.54412,7.82353 4.64706,7.82353 q -0.88235,0 -1.5,-0.617648 L 1.617647,5.676471 Q 1,5.058824 1,4.176471 1,3.294118 1.625,2.683824 L 2.70588,1.610294 Q 3.31618,1 4.19853,1 q 0.88971,0 1.5,0.625 l 1.51471,1.522059 q 0.61029,0.610294 0.61029,1.492647 0,0.904412 -0.64706,1.536764 L 7.82353,6.823529 Q 8.45588,6.17647 9.35294,6.17647 q 0.88235,0 1.5,0.617648 l 1.52941,1.529411 Q 13,8.941176 13,9.823529 z&quot;/&gt;&lt;/svg&gt;
          &lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;The Swift project adds new language features through the &lt;a href=&quot;/swift-evolution/&quot;&gt;Swift Evolution process&lt;/a&gt;. These are some of the proposals currently under review or recently accepted for a future Swift release.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Under active review:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;&lt;a href=&quot;https://github.com/swiftlang/swift-evolution/blob/main/proposals/0506-advanced-observation-tracking.md&quot;&gt;SE-0506&lt;/a&gt; Advanced Observation Tracking - &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;@Observable&lt;/code&gt; types automatically track when their properties change. However, advanced use cases like developing middleware infrastructure or widgeting systems require more control and features. This proposal adds options to the existing &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;withObservationTracking&lt;/code&gt; to control when/which changes are observed, and a continuous variant that re-observes automatically after coalesced events.&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://github.com/swiftlang/swift-evolution/blob/main/proposals/0507-borrow-accessors.md&quot;&gt;SE-0507&lt;/a&gt; Borrow and Mutate Accessors - When you read or write a Swift property, the code that handles that access currently either makes a copy of the value or uses coroutines, which have performance overhead. This proposal adds new &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;borrow&lt;/code&gt; and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;mutate&lt;/code&gt; keywords that let properties provide direct access to their stored values and enables properties that hold values that can’t be copied.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Recently accepted:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;&lt;a href=&quot;https://github.com/swiftlang/swift-evolution/blob/main/proposals/0498-runtime-demangle.md&quot;&gt;SE-0498&lt;/a&gt; Expose demangle function in Runtime module - The Swift compiler uses name mangling, turning Swift symbols into strings like &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;$sSS7cStringSSSPys4Int8VG_tcfC&lt;/code&gt; which show up in backtraces and profiling tools. There are times, however, when a human-readable format is preferable. This proposal introduces a new API that allows calling out to the Swift runtime’s demangler, without leaving the process.&lt;/li&gt;
&lt;/ul&gt;
</content>
  </entry>
  
  <entry>
    <title>Announcing the Windows Workgroup</title>
    
      
        
        <author>
        
          <name>Mishal Shah</name>
        
        </author>
      
    
    <link href="https://swift.org/blog/announcing-windows-workgroup/"/>
    <updated>2026-01-26T08:00:00-04:00</updated>
    <id>https://swift.org/blog/announcing-windows-workgroup/</id>
    <content type="html">&lt;p&gt;We are excited to announce the creation of the &lt;a href=&quot;/windows-workgroup/&quot;&gt;Windows workgroup&lt;/a&gt;!&lt;/p&gt;

&lt;p&gt;The primary goal is to ensure ongoing support for Swift on Windows, enabling users to develop Windows applications using the Swift programming language and its associated tools.&lt;/p&gt;

&lt;p&gt;The new Windows workgroup joins a growing list of Swift workgroups, including the &lt;a href=&quot;/android-workgroup/&quot;&gt;Android workgroup&lt;/a&gt;, &lt;a href=&quot;/build-and-packaging-workgroup/&quot;&gt;Build and Packaging workgroup&lt;/a&gt;, and &lt;a href=&quot;/testing-workgroup/&quot;&gt;Testing workgroup&lt;/a&gt; which were all added in the past year. Swift workgroups are community-led efforts, formally recognized by the project, to help move forward key areas.&lt;/p&gt;

&lt;p&gt;Windows has been an &lt;a href=&quot;/blog/swift-on-windows/&quot;&gt;officially supported platform&lt;/a&gt; since 2020, and there’s been great progress since then. The &lt;a href=&quot;/blog/vscode-extension/&quot;&gt;VS Code extension&lt;/a&gt; supports Windows, and we’ve seen the community take advantage of Swift’s features on Windows, some of which are described in a 2023 blog post about &lt;a href=&quot;/blog/swift-everywhere-windows-interop/&quot;&gt;Using Interoperability to Build on Windows&lt;/a&gt;. The workgroup will build upon these efforts and focus on work to:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;Improve and maintain Windows support for the official Swift distribution.&lt;/li&gt;
  &lt;li&gt;Recommend enhancements to core Swift packages such as Foundation and Dispatch to work better with Windows idioms.&lt;/li&gt;
  &lt;li&gt;Make recommendations to the Swift Project about the direction of future Windows support in Swift.&lt;/li&gt;
  &lt;li&gt;Identify and recommend best practices for bridging between Swift and the Windows API, and for shipping Swift libraries with Windows applications.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;To learn more and get involved:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;a href=&quot;https://forums.swift.org/t/announcing-the-windows-workgroup/84374&quot;&gt;Discuss this announcement&lt;/a&gt; on the forums, and share ideas in the &lt;a href=&quot;https://forums.swift.org/c/platform/windows/67&quot;&gt;Windows&lt;/a&gt; category.&lt;/li&gt;
  &lt;li&gt;Learn more about the Windows workgroup by reading its &lt;a href=&quot;/windows-workgroup/&quot;&gt;charter&lt;/a&gt;.&lt;/li&gt;
  &lt;li&gt;Join the Windows workgroup’s meetings every other Wednesday at 9:00 AM PT (Pacific Time Zone).
    &lt;ul&gt;
      &lt;li&gt;Workgroup membership and meetings are open to those who wish to participate, and contributors are welcome!&lt;/li&gt;
      &lt;li&gt;To receive an invite, send a message to &lt;a href=&quot;https://forums.swift.org/new-message?groupname=windows-workgroup&quot;&gt;@windows-workgroup&lt;/a&gt; on the Swift forums.&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
&lt;/ul&gt;
</content>
  </entry>
  
  <entry>
    <title>Improving the usability of C libraries in Swift</title>
    
      
        
        <author>
        
          <name>Doug Gregor</name>
        
        </author>
      
    
    <link href="https://swift.org/blog/improving-usability-of-c-libraries-in-swift/"/>
    <updated>2026-01-22T08:00:00-04:00</updated>
    <id>https://swift.org/blog/improving-usability-of-c-libraries-in-swift/</id>
    <content type="html">&lt;p&gt;There are many interesting, useful, and fun C libraries in the software ecosystem. While one could go and rewrite these libraries in Swift, usually there is no need, because Swift provides direct interoperability with C. With a little setup, you can directly use existing C libraries from your Swift code.&lt;/p&gt;

&lt;p&gt;When you use a C library directly from Swift, it will look and feel similar to using it from C. That can be useful if you’re following sample code or a tutorial written in C, but it can also feel out of place. For example, here’s a small amount of code using a C API:&lt;/p&gt;

&lt;div class=&quot;language-swift highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;  &lt;span class=&quot;k&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;instanceDescriptor&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;WGPUInstanceDescriptor&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
  &lt;span class=&quot;k&quot;&gt;let&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;instance&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;wgpuCreateInstance&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;amp;&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;instanceDescriptor&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;k&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;surfaceDescriptor&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;WGPUSurfaceDescriptor&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
  &lt;span class=&quot;k&quot;&gt;let&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;surface&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;wgpuInstanceCreateSurface&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;instance&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;amp;&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;surfaceDescriptor&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;wgpuSurfacePresent&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;amp;&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;surface&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;==&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;WGPUStatus_Error&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
      &lt;span class=&quot;c1&quot;&gt;// report error&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
  &lt;span class=&quot;nf&quot;&gt;wgpuSurfaceRelease&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;surface&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;nf&quot;&gt;wgpuInstanceRelease&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;instance&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;The C library here that Swift is using comes from the &lt;a href=&quot;https://github.com/webgpu-native/webgpu-headers&quot;&gt;webgpu-headers project&lt;/a&gt;, which vends a C header (&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;webgpu.h&lt;/code&gt;) that is used by several implementations of &lt;a href=&quot;https://www.w3.org/TR/webgpu/&quot;&gt;WebGPU&lt;/a&gt;. WebGPU  is a technology that enables web developers to use the system’s GPU (Graphics Processing Unit) from the browser. For the purposes of this post, you don’t really need to know anything about WebGPU: I’m using it as an example of a typical C library, and the techniques described in this blog post apply to lots of other well-designed C libraries.&lt;/p&gt;

&lt;p&gt;The Swift code above has a very “C” feel to it. It has global function calls with prefixed names like &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;wgpuInstanceCreateSurface&lt;/code&gt; and global integer constants like &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;WGPUStatus_Error&lt;/code&gt;. It pervasively uses unsafe pointers, some of which are managed with explicit reference counting, where the user provides calls to &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;wpuXYZAddRef&lt;/code&gt; and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;wgpuXYZRelease&lt;/code&gt; functions. It works, but it doesn’t feel like Swift, and inherits various safety problems of C.&lt;/p&gt;

&lt;p&gt;Fortunately, we can improve this situation, providing a safer and more ergonomic interface to WebGPU from Swift that feels like it belongs in Swift. More importantly, we can do so without changing the WebGPU implementation: Swift provides a suite of annotations that you can apply to C headers to improve the way in which the C APIs are expressed in Swift. These annotations describe common conventions in C that match up with Swift constructs, projecting a more Swift-friendly interface on top of the C code.&lt;/p&gt;

&lt;p&gt;In this post, I’m going to use these annotations to improve how Swift interacts with the WebGPU C code. By the end, we’ll be able to take advantage of Swift features like argument labels, methods, enums, and automatic reference counting, like this:&lt;/p&gt;

&lt;div class=&quot;language-swift highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;  &lt;span class=&quot;k&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;instanceDescriptor&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;WGPUInstanceDescriptor&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
  &lt;span class=&quot;k&quot;&gt;let&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;instance&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;WGPUInstance&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;descriptor&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;amp;&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;instanceDescriptor&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;k&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;surfaceDescriptor&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;WGPUSurfaceDescriptor&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
  &lt;span class=&quot;k&quot;&gt;let&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;surface&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;instance&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;createSurface&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;descriptor&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;amp;&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;surfaceDescriptor&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;surface&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;present&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;==&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;error&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
      &lt;span class=&quot;c1&quot;&gt;// report error&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
  &lt;span class=&quot;c1&quot;&gt;// Swift automatically deallocates the instance and surface when we&apos;re done&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;These same annotations can be used for any C library to provide a safer, more ergonomic development experience in Swift without changing the C library at all.&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;&lt;strong&gt;Note&lt;/strong&gt;: Some of what is covered in this post requires bug fixes that first became available in Swift 6.2.3.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2 id=&quot;setup-writing-a-module-map&quot; class=&quot;header-with-anchor&quot;&gt;Setup: Writing a module map &lt;a title=&quot;Permalink for Setup: Writing a module map section&quot; href=&quot;#setup-writing-a-module-map&quot;&gt;
            &lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt; &lt;svg width=&quot;18px&quot; height=&quot;18px&quot; viewBox=&quot;0 0 14 14&quot; role=&quot;img&quot; focusable=&quot;false&quot; aria-hidden=&quot;true&quot; xmlns=&quot;http://www.w3.org/2000/svg&quot;&gt;&lt;path d=&quot;m 11.58824,9.823529 q 0,-0.294117 -0.20589,-0.499999 L 9.85294,7.794118 q -0.20588,-0.205883 -0.5,-0.205883 -0.30882,0 -0.52941,0.235295 0.0221,0.02206 0.13971,0.136029 0.11764,0.113971 0.15808,0.158088 0.0404,0.04412 0.1103,0.139706 0.0698,0.09559 0.0956,0.1875 0.0257,0.09191 0.0257,0.202206 0,0.294117 -0.20588,0.5 -0.20588,0.205882 -0.5,0.205882 -0.1103,0 -0.20221,-0.02573 Q 8.35293,9.301471 8.25733,9.231621 8.16173,9.161771 8.11763,9.121327 8.07353,9.080887 7.95954,8.963238 7.84557,8.845591 7.82351,8.823533 7.58086,9.051474 7.58086,9.360297 q 0,0.294118 0.20588,0.5 l 1.51471,1.522059 q 0.19853,0.19853 0.5,0.19853 0.29412,0 0.5,-0.191177 l 1.08088,-1.073529 q 0.20589,-0.205883 0.20589,-0.492648 z M 6.41912,4.639706 q 0,-0.294118 -0.20588,-0.5 L 4.69853,2.617647 q -0.20588,-0.205882 -0.5,-0.205882 -0.28677,0 -0.5,0.198529 L 2.61765,3.683823 q -0.20589,0.205883 -0.20589,0.492648 0,0.294117 0.20589,0.499999 l 1.52941,1.529412 q 0.19853,0.19853 0.5,0.19853 0.30882,0 0.52941,-0.227942 Q 5.15437,6.15441 5.03676,6.040441 4.91912,5.92647 4.87868,5.882353 4.83828,5.838233 4.76838,5.742647 q -0.0698,-0.09559 -0.0956,-0.1875 -0.0257,-0.09191 -0.0257,-0.202206 0,-0.294117 0.20588,-0.5 0.20588,-0.205882 0.5,-0.205882 0.1103,0 0.20221,0.02573 0.0919,0.02573 0.1875,0.09559 0.0956,0.06985 0.1397,0.110294 0.0441,0.04044 0.15809,0.158089 Q 6.15443,5.154409 6.17649,5.176467 6.41914,4.948526 6.41914,4.639703 z M 13,9.823529 q 0,0.882353 -0.625,1.492647 l -1.08088,1.07353 Q 10.68382,13 9.80147,13 q -0.88971,0 -1.5,-0.625 L 6.78676,10.852941 Q 6.17647,10.242647 6.17647,9.360294 q 0,-0.904412 0.64706,-1.536764 L 6.17647,7.176471 Q 5.54412,7.82353 4.64706,7.82353 q -0.88235,0 -1.5,-0.617648 L 1.617647,5.676471 Q 1,5.058824 1,4.176471 1,3.294118 1.625,2.683824 L 2.70588,1.610294 Q 3.31618,1 4.19853,1 q 0.88971,0 1.5,0.625 l 1.51471,1.522059 q 0.61029,0.610294 0.61029,1.492647 0,0.904412 -0.64706,1.536764 L 7.82353,6.823529 Q 8.45588,6.17647 9.35294,6.17647 q 0.88235,0 1.5,0.617648 l 1.52941,1.529411 Q 13,8.941176 13,9.823529 z&quot;/&gt;&lt;/svg&gt;
          &lt;/a&gt;&lt;/h2&gt;

&lt;p&gt;A &lt;a href=&quot;https://clang.llvm.org/docs/Modules.html&quot;&gt;module map&lt;/a&gt; is a way of layering a Swift-friendly modular structure on top of C headers. You can create a module map for the WebGPU header by writing the following to a file &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;module.modulemap&lt;/code&gt;:&lt;/p&gt;

&lt;div class=&quot;language-swift highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;n&quot;&gt;module&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;WebGPU&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;header&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;webgpu.h&quot;&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;export&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;*&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;The easiest thing to do is to put &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;module.modulemap&lt;/code&gt; alongside the header itself. For my experiment here, I put it in the root directory of my &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;webgpu-headers&lt;/code&gt; checkout. If you’re in a Swift package, put it into its own target with this layout:&lt;/p&gt;

&lt;div class=&quot;language-swift highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;err&quot;&gt;├──&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;Package&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;swift&lt;/span&gt;
&lt;span class=&quot;err&quot;&gt;└──&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;Sources&lt;/span&gt;
    &lt;span class=&quot;err&quot;&gt;└──&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;WebGPU&lt;/span&gt;
        &lt;span class=&quot;err&quot;&gt;├──&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;include&lt;/span&gt;
        &lt;span class=&quot;err&quot;&gt;│&lt;/span&gt;   &lt;span class=&quot;err&quot;&gt;├──&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;webgpu&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;h&lt;/span&gt;
        &lt;span class=&quot;err&quot;&gt;│&lt;/span&gt;   &lt;span class=&quot;err&quot;&gt;└──&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;module&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;modulemap&lt;/span&gt;
        &lt;span class=&quot;err&quot;&gt;└──&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;WebGPU&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;c&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;empty&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;file&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;If you reference this &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;WebGPU&lt;/code&gt; target from elsewhere in the package, you can &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;import WebGPU&lt;/code&gt; to get access to the C APIs.&lt;/p&gt;

&lt;h2 id=&quot;seeing-the-results&quot; class=&quot;header-with-anchor&quot;&gt;Seeing the results &lt;a title=&quot;Permalink for Seeing the results section&quot; href=&quot;#seeing-the-results&quot;&gt;
            &lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt; &lt;svg width=&quot;18px&quot; height=&quot;18px&quot; viewBox=&quot;0 0 14 14&quot; role=&quot;img&quot; focusable=&quot;false&quot; aria-hidden=&quot;true&quot; xmlns=&quot;http://www.w3.org/2000/svg&quot;&gt;&lt;path d=&quot;m 11.58824,9.823529 q 0,-0.294117 -0.20589,-0.499999 L 9.85294,7.794118 q -0.20588,-0.205883 -0.5,-0.205883 -0.30882,0 -0.52941,0.235295 0.0221,0.02206 0.13971,0.136029 0.11764,0.113971 0.15808,0.158088 0.0404,0.04412 0.1103,0.139706 0.0698,0.09559 0.0956,0.1875 0.0257,0.09191 0.0257,0.202206 0,0.294117 -0.20588,0.5 -0.20588,0.205882 -0.5,0.205882 -0.1103,0 -0.20221,-0.02573 Q 8.35293,9.301471 8.25733,9.231621 8.16173,9.161771 8.11763,9.121327 8.07353,9.080887 7.95954,8.963238 7.84557,8.845591 7.82351,8.823533 7.58086,9.051474 7.58086,9.360297 q 0,0.294118 0.20588,0.5 l 1.51471,1.522059 q 0.19853,0.19853 0.5,0.19853 0.29412,0 0.5,-0.191177 l 1.08088,-1.073529 q 0.20589,-0.205883 0.20589,-0.492648 z M 6.41912,4.639706 q 0,-0.294118 -0.20588,-0.5 L 4.69853,2.617647 q -0.20588,-0.205882 -0.5,-0.205882 -0.28677,0 -0.5,0.198529 L 2.61765,3.683823 q -0.20589,0.205883 -0.20589,0.492648 0,0.294117 0.20589,0.499999 l 1.52941,1.529412 q 0.19853,0.19853 0.5,0.19853 0.30882,0 0.52941,-0.227942 Q 5.15437,6.15441 5.03676,6.040441 4.91912,5.92647 4.87868,5.882353 4.83828,5.838233 4.76838,5.742647 q -0.0698,-0.09559 -0.0956,-0.1875 -0.0257,-0.09191 -0.0257,-0.202206 0,-0.294117 0.20588,-0.5 0.20588,-0.205882 0.5,-0.205882 0.1103,0 0.20221,0.02573 0.0919,0.02573 0.1875,0.09559 0.0956,0.06985 0.1397,0.110294 0.0441,0.04044 0.15809,0.158089 Q 6.15443,5.154409 6.17649,5.176467 6.41914,4.948526 6.41914,4.639703 z M 13,9.823529 q 0,0.882353 -0.625,1.492647 l -1.08088,1.07353 Q 10.68382,13 9.80147,13 q -0.88971,0 -1.5,-0.625 L 6.78676,10.852941 Q 6.17647,10.242647 6.17647,9.360294 q 0,-0.904412 0.64706,-1.536764 L 6.17647,7.176471 Q 5.54412,7.82353 4.64706,7.82353 q -0.88235,0 -1.5,-0.617648 L 1.617647,5.676471 Q 1,5.058824 1,4.176471 1,3.294118 1.625,2.683824 L 2.70588,1.610294 Q 3.31618,1 4.19853,1 q 0.88971,0 1.5,0.625 l 1.51471,1.522059 q 0.61029,0.610294 0.61029,1.492647 0,0.904412 -0.64706,1.536764 L 7.82353,6.823529 Q 8.45588,6.17647 9.35294,6.17647 q 0.88235,0 1.5,0.617648 l 1.52941,1.529411 Q 13,8.941176 13,9.823529 z&quot;/&gt;&lt;/svg&gt;
          &lt;/a&gt;&lt;/h2&gt;

&lt;p&gt;There are a few ways to see what the Swift interface for a C library looks like.&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;The &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;swift-synthesize-interface&lt;/code&gt; tool in Swift 6.2+ prints the Swift interface to the terminal.&lt;/li&gt;
  &lt;li&gt;Xcode’s “Swift 5 interface” counterpart to the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;webgpu.h&lt;/code&gt; header will show how the header has been mapped into Swift.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Let’s do it from the command line, using &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;swift-synthesize-interface&lt;/code&gt;. From the directory containing &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;webgpu.h&lt;/code&gt; and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;module.modulemap&lt;/code&gt;, run:&lt;/p&gt;

&lt;div class=&quot;language-swift highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;n&quot;&gt;xcrun&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;swift&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;synthesize&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;interface&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;I&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;.&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;module&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;name&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;WebGPU&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;target&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;arm64&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;apple&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;macos15&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;sdk&lt;/span&gt; &lt;span class=&quot;sr&quot;&gt;/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;MacOSX26&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;sdk&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;The leading &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;xcrun&lt;/code&gt; and the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;-sdk&lt;/code&gt; argument with the path is only needed on macOS; on other platforms, make sure &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;swift-synthesize-interface&lt;/code&gt; is in your path. The &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;-target&lt;/code&gt; operation is the triple provided if you run &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;swiftc -print-target-info&lt;/code&gt;. It looks like this:&lt;/p&gt;

&lt;div class=&quot;language-json highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
  &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;compilerVersion&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;Apple Swift version 6.2 (swiftlang-6.2.2.15.4 clang-1700.3.15.2)&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
  &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;target&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;triple&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;arm64-apple-macosx15.0&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;unversionedTriple&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;arm64-apple-macosx&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;moduleTriple&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;arm64-apple-macos&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;compatibilityLibraries&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;],&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;librariesRequireRPath&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;kc&quot;&gt;false&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
  &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;},&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
  &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;paths&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;err&quot;&gt;...&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;The output of &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;swift-synthesize-interface&lt;/code&gt; is the Swift API for the WebGPU module, directly translated from C. For example, this code from the WebGPU header:&lt;/p&gt;

&lt;div class=&quot;language-c highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;k&quot;&gt;typedef&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;enum&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;WGPUAdapterType&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;WGPUAdapterType_DiscreteGPU&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;mh&quot;&gt;0x00000001&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;WGPUAdapterType_IntegratedGPU&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;mh&quot;&gt;0x00000002&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;WGPUAdapterType_CPU&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;mh&quot;&gt;0x00000003&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;WGPUAdapterType_Unknown&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;mh&quot;&gt;0x00000004&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;WGPUAdapterType_Force32&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;mh&quot;&gt;0x7FFFFFFF&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;WGPUAdapterType&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;WGPU_ENUM_ATTRIBUTE&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;is translated into:&lt;/p&gt;

&lt;div class=&quot;language-swift highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;kd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;struct&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;WGPUAdapterType&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;Hashable&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;Equatable&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;RawRepresentable&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;kd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;init&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;_&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;rawValue&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;UInt32&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;kd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;init&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;rawValue&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;UInt32&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;kd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;rawValue&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;UInt32&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;

&lt;span class=&quot;kd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;WGPUAdapterType_DiscreteGPU&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;WGPUAdapterType&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;get&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;kd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;WGPUAdapterType_IntegratedGPU&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;WGPUAdapterType&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;get&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;kd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;WGPUAdapterType_CPU&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;WGPUAdapterType&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;get&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;kd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;WGPUAdapterType_Unknown&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;WGPUAdapterType&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;get&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;kd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;WGPUAdapterType_Force32&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;WGPUAdapterType&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;get&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;and there are lots of global functions like this:&lt;/p&gt;

&lt;div class=&quot;language-swift highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;kd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;func&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;wgpuComputePipelineGetBindGroupLayout&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;_&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;computePipeline&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;WGPUComputePipeline&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;!&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;_&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;groupIndex&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;UInt32&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;WGPUBindGroupLayout&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;!&lt;/span&gt;
&lt;span class=&quot;kd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;func&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;wgpuComputePipelineSetLabel&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;_&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;computePipeline&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;WGPUComputePipeline&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;!&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;_&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;label&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;WGPUStringView&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;kd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;func&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;wgpuComputePipelineAddRef&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;_&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;computePipeline&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;WGPUComputePipeline&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;!&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;kd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;func&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;wgpuComputePipelineRelease&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;_&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;computePipeline&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;WGPUComputePipeline&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;!&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;It’s a starting point! You can absolutely write Swift programs using these WebGPU APIs, and they’ll feel a lot like writing them in C. Let’s see what we can do to make it better.&lt;/p&gt;

&lt;h2 id=&quot;cleaning-up-enumeration-types&quot; class=&quot;header-with-anchor&quot;&gt;Cleaning up enumeration types &lt;a title=&quot;Permalink for Cleaning up enumeration types section&quot; href=&quot;#cleaning-up-enumeration-types&quot;&gt;
            &lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt; &lt;svg width=&quot;18px&quot; height=&quot;18px&quot; viewBox=&quot;0 0 14 14&quot; role=&quot;img&quot; focusable=&quot;false&quot; aria-hidden=&quot;true&quot; xmlns=&quot;http://www.w3.org/2000/svg&quot;&gt;&lt;path d=&quot;m 11.58824,9.823529 q 0,-0.294117 -0.20589,-0.499999 L 9.85294,7.794118 q -0.20588,-0.205883 -0.5,-0.205883 -0.30882,0 -0.52941,0.235295 0.0221,0.02206 0.13971,0.136029 0.11764,0.113971 0.15808,0.158088 0.0404,0.04412 0.1103,0.139706 0.0698,0.09559 0.0956,0.1875 0.0257,0.09191 0.0257,0.202206 0,0.294117 -0.20588,0.5 -0.20588,0.205882 -0.5,0.205882 -0.1103,0 -0.20221,-0.02573 Q 8.35293,9.301471 8.25733,9.231621 8.16173,9.161771 8.11763,9.121327 8.07353,9.080887 7.95954,8.963238 7.84557,8.845591 7.82351,8.823533 7.58086,9.051474 7.58086,9.360297 q 0,0.294118 0.20588,0.5 l 1.51471,1.522059 q 0.19853,0.19853 0.5,0.19853 0.29412,0 0.5,-0.191177 l 1.08088,-1.073529 q 0.20589,-0.205883 0.20589,-0.492648 z M 6.41912,4.639706 q 0,-0.294118 -0.20588,-0.5 L 4.69853,2.617647 q -0.20588,-0.205882 -0.5,-0.205882 -0.28677,0 -0.5,0.198529 L 2.61765,3.683823 q -0.20589,0.205883 -0.20589,0.492648 0,0.294117 0.20589,0.499999 l 1.52941,1.529412 q 0.19853,0.19853 0.5,0.19853 0.30882,0 0.52941,-0.227942 Q 5.15437,6.15441 5.03676,6.040441 4.91912,5.92647 4.87868,5.882353 4.83828,5.838233 4.76838,5.742647 q -0.0698,-0.09559 -0.0956,-0.1875 -0.0257,-0.09191 -0.0257,-0.202206 0,-0.294117 0.20588,-0.5 0.20588,-0.205882 0.5,-0.205882 0.1103,0 0.20221,0.02573 0.0919,0.02573 0.1875,0.09559 0.0956,0.06985 0.1397,0.110294 0.0441,0.04044 0.15809,0.158089 Q 6.15443,5.154409 6.17649,5.176467 6.41914,4.948526 6.41914,4.639703 z M 13,9.823529 q 0,0.882353 -0.625,1.492647 l -1.08088,1.07353 Q 10.68382,13 9.80147,13 q -0.88971,0 -1.5,-0.625 L 6.78676,10.852941 Q 6.17647,10.242647 6.17647,9.360294 q 0,-0.904412 0.64706,-1.536764 L 6.17647,7.176471 Q 5.54412,7.82353 4.64706,7.82353 q -0.88235,0 -1.5,-0.617648 L 1.617647,5.676471 Q 1,5.058824 1,4.176471 1,3.294118 1.625,2.683824 L 2.70588,1.610294 Q 3.31618,1 4.19853,1 q 0.88971,0 1.5,0.625 l 1.51471,1.522059 q 0.61029,0.610294 0.61029,1.492647 0,0.904412 -0.64706,1.536764 L 7.82353,6.823529 Q 8.45588,6.17647 9.35294,6.17647 q 0.88235,0 1.5,0.617648 l 1.52941,1.529411 Q 13,8.941176 13,9.823529 z&quot;/&gt;&lt;/svg&gt;
          &lt;/a&gt;&lt;/h2&gt;

&lt;p&gt;C enums can be used for several things. Sometimes they really represent a choice among a number of alternatives. Sometimes they represent flags in a set of options, from which you can choose several. Sometimes they’re just a convenient way to create a bunch of named constants. Swift conservatively imports enum types as wrappers over the underlying C type used to store values of the enum (e.g., &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;WGPUAdapterType&lt;/code&gt; wraps a &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;UInt32&lt;/code&gt;) and makes the enumerators into global constants. It covers all of the possible use cases, but it isn’t &lt;em&gt;nice&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;The &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;WGPUAdapterType&lt;/code&gt; enum really is a choice among one of several options, which would be best represented as an &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;enum&lt;/code&gt; in Swift. If we were willing to modify the header, we could apply the &lt;a href=&quot;https://clang.llvm.org/docs/AttributeReference.html#enum-extensibility&quot;&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;enum_extensibility&lt;/code&gt; attribute&lt;/a&gt; to the enum, like this:&lt;/p&gt;

&lt;div class=&quot;language-c highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;k&quot;&gt;typedef&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;enum&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;__attribute__&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;((&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;enum_extensibility&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;closed&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)))&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;WGPUAdapterType&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;WGPUAdapterType_DiscreteGPU&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;mh&quot;&gt;0x00000001&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;WGPUAdapterType_IntegratedGPU&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;mh&quot;&gt;0x00000002&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;WGPUAdapterType_CPU&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;mh&quot;&gt;0x00000003&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;WGPUAdapterType_Unknown&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;mh&quot;&gt;0x00000004&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;WGPUAdapterType_Force32&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;mh&quot;&gt;0x7FFFFFFF&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;WGPUAdapterType&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;WGPU_ENUM_ATTRIBUTE&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;This works, and results in a much nicer Swift API:&lt;/p&gt;

&lt;div class=&quot;language-swift highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;kd&quot;&gt;@frozen&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;enum&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;WGPUAdapterType&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;UInt32&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;@unchecked&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;Sendable&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;case&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;discreteGPU&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;case&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;integratedGPU&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;2&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;case&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;CPU&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;3&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;case&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;unknown&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;4&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;case&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;force32&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;2147483647&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Now, we get an &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;enum&lt;/code&gt; that we can switch over, and nice short case names, e.g.,&lt;/p&gt;

&lt;div class=&quot;language-swift highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;k&quot;&gt;switch&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;adapterType&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
  &lt;span class=&quot;k&quot;&gt;case&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;discreteGPU&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;integratedGPU&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;
    &lt;span class=&quot;nf&quot;&gt;print&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;definitely a GPU&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;k&quot;&gt;default&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;
    &lt;span class=&quot;nf&quot;&gt;print&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;not so sure&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;That’s great, but I already broke my rule: no header modifications unless I have to!&lt;/p&gt;

&lt;h2 id=&quot;api-notes&quot; class=&quot;header-with-anchor&quot;&gt;API notes &lt;a title=&quot;Permalink for API notes section&quot; href=&quot;#api-notes&quot;&gt;
            &lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt; &lt;svg width=&quot;18px&quot; height=&quot;18px&quot; viewBox=&quot;0 0 14 14&quot; role=&quot;img&quot; focusable=&quot;false&quot; aria-hidden=&quot;true&quot; xmlns=&quot;http://www.w3.org/2000/svg&quot;&gt;&lt;path d=&quot;m 11.58824,9.823529 q 0,-0.294117 -0.20589,-0.499999 L 9.85294,7.794118 q -0.20588,-0.205883 -0.5,-0.205883 -0.30882,0 -0.52941,0.235295 0.0221,0.02206 0.13971,0.136029 0.11764,0.113971 0.15808,0.158088 0.0404,0.04412 0.1103,0.139706 0.0698,0.09559 0.0956,0.1875 0.0257,0.09191 0.0257,0.202206 0,0.294117 -0.20588,0.5 -0.20588,0.205882 -0.5,0.205882 -0.1103,0 -0.20221,-0.02573 Q 8.35293,9.301471 8.25733,9.231621 8.16173,9.161771 8.11763,9.121327 8.07353,9.080887 7.95954,8.963238 7.84557,8.845591 7.82351,8.823533 7.58086,9.051474 7.58086,9.360297 q 0,0.294118 0.20588,0.5 l 1.51471,1.522059 q 0.19853,0.19853 0.5,0.19853 0.29412,0 0.5,-0.191177 l 1.08088,-1.073529 q 0.20589,-0.205883 0.20589,-0.492648 z M 6.41912,4.639706 q 0,-0.294118 -0.20588,-0.5 L 4.69853,2.617647 q -0.20588,-0.205882 -0.5,-0.205882 -0.28677,0 -0.5,0.198529 L 2.61765,3.683823 q -0.20589,0.205883 -0.20589,0.492648 0,0.294117 0.20589,0.499999 l 1.52941,1.529412 q 0.19853,0.19853 0.5,0.19853 0.30882,0 0.52941,-0.227942 Q 5.15437,6.15441 5.03676,6.040441 4.91912,5.92647 4.87868,5.882353 4.83828,5.838233 4.76838,5.742647 q -0.0698,-0.09559 -0.0956,-0.1875 -0.0257,-0.09191 -0.0257,-0.202206 0,-0.294117 0.20588,-0.5 0.20588,-0.205882 0.5,-0.205882 0.1103,0 0.20221,0.02573 0.0919,0.02573 0.1875,0.09559 0.0956,0.06985 0.1397,0.110294 0.0441,0.04044 0.15809,0.158089 Q 6.15443,5.154409 6.17649,5.176467 6.41914,4.948526 6.41914,4.639703 z M 13,9.823529 q 0,0.882353 -0.625,1.492647 l -1.08088,1.07353 Q 10.68382,13 9.80147,13 q -0.88971,0 -1.5,-0.625 L 6.78676,10.852941 Q 6.17647,10.242647 6.17647,9.360294 q 0,-0.904412 0.64706,-1.536764 L 6.17647,7.176471 Q 5.54412,7.82353 4.64706,7.82353 q -0.88235,0 -1.5,-0.617648 L 1.617647,5.676471 Q 1,5.058824 1,4.176471 1,3.294118 1.625,2.683824 L 2.70588,1.610294 Q 3.31618,1 4.19853,1 q 0.88971,0 1.5,0.625 l 1.51471,1.522059 q 0.61029,0.610294 0.61029,1.492647 0,0.904412 -0.64706,1.536764 L 7.82353,6.823529 Q 8.45588,6.17647 9.35294,6.17647 q 0.88235,0 1.5,0.617648 l 1.52941,1.529411 Q 13,8.941176 13,9.823529 z&quot;/&gt;&lt;/svg&gt;
          &lt;/a&gt;&lt;/h2&gt;

&lt;p&gt;The problem of needing to layer information on top of existing C headers is not a new one. As noted earlier, Swift relies on a Clang feature called &lt;a href=&quot;https://clang.llvm.org/docs/APINotes.html&quot;&gt;API notes&lt;/a&gt; to let us express this same information in a separate file, so we don’t have to edit the header. In this case, we create a file called &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;WebGPU.apinotes&lt;/code&gt; (the name &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;WebGPU&lt;/code&gt; matches the module name from &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;module.modulemap&lt;/code&gt;), which is a YAML file describing the extra information. We’ll start with one that turns &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;WGPUAdapterType&lt;/code&gt; into an &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;enum&lt;/code&gt;:&lt;/p&gt;

&lt;div class=&quot;language-yaml highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nn&quot;&gt;---&lt;/span&gt;
&lt;span class=&quot;na&quot;&gt;Name&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;WebGPU&lt;/span&gt;
&lt;span class=&quot;na&quot;&gt;Tags&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
&lt;span class=&quot;pi&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;Name&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;WGPUAdapterType&lt;/span&gt;
  &lt;span class=&quot;na&quot;&gt;EnumExtensibility&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;closed&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Tags&lt;/code&gt; here is a term used in the C and C++ standard to refer to enum, struct, union, or class types. Any information about those types in the API notes file will go into that section.&lt;/p&gt;

&lt;p&gt;Put &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;WebGPU.apinotes&lt;/code&gt; alongside the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;module.modulemap&lt;/code&gt;, and now &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;WGPUAdapterType&lt;/code&gt; gets mapped into a &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Swift&lt;/code&gt; enum. For a package, the structure will look like this:&lt;/p&gt;

&lt;div class=&quot;language-swift highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;err&quot;&gt;├──&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;Package&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;swift&lt;/span&gt;
&lt;span class=&quot;err&quot;&gt;└──&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;Sources&lt;/span&gt;
    &lt;span class=&quot;err&quot;&gt;└──&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;WebGPU&lt;/span&gt;
        &lt;span class=&quot;err&quot;&gt;├──&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;include&lt;/span&gt;
        &lt;span class=&quot;err&quot;&gt;│&lt;/span&gt;   &lt;span class=&quot;err&quot;&gt;├──&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;webgpu&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;h&lt;/span&gt;
        &lt;span class=&quot;err&quot;&gt;│&lt;/span&gt;   &lt;span class=&quot;err&quot;&gt;├──&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;WebGPU&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;apinotes&lt;/span&gt;
        &lt;span class=&quot;err&quot;&gt;│&lt;/span&gt;   &lt;span class=&quot;err&quot;&gt;└──&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;module&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;modulemap&lt;/span&gt;
        &lt;span class=&quot;err&quot;&gt;└──&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;WebGPU&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;c&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;empty&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;file&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;We’ll be adding more to this API notes file as we keep digging through the interface.&lt;/p&gt;

&lt;h2 id=&quot;reference-counted-object-types&quot; class=&quot;header-with-anchor&quot;&gt;Reference-counted object types &lt;a title=&quot;Permalink for Reference-counted object types section&quot; href=&quot;#reference-counted-object-types&quot;&gt;
            &lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt; &lt;svg width=&quot;18px&quot; height=&quot;18px&quot; viewBox=&quot;0 0 14 14&quot; role=&quot;img&quot; focusable=&quot;false&quot; aria-hidden=&quot;true&quot; xmlns=&quot;http://www.w3.org/2000/svg&quot;&gt;&lt;path d=&quot;m 11.58824,9.823529 q 0,-0.294117 -0.20589,-0.499999 L 9.85294,7.794118 q -0.20588,-0.205883 -0.5,-0.205883 -0.30882,0 -0.52941,0.235295 0.0221,0.02206 0.13971,0.136029 0.11764,0.113971 0.15808,0.158088 0.0404,0.04412 0.1103,0.139706 0.0698,0.09559 0.0956,0.1875 0.0257,0.09191 0.0257,0.202206 0,0.294117 -0.20588,0.5 -0.20588,0.205882 -0.5,0.205882 -0.1103,0 -0.20221,-0.02573 Q 8.35293,9.301471 8.25733,9.231621 8.16173,9.161771 8.11763,9.121327 8.07353,9.080887 7.95954,8.963238 7.84557,8.845591 7.82351,8.823533 7.58086,9.051474 7.58086,9.360297 q 0,0.294118 0.20588,0.5 l 1.51471,1.522059 q 0.19853,0.19853 0.5,0.19853 0.29412,0 0.5,-0.191177 l 1.08088,-1.073529 q 0.20589,-0.205883 0.20589,-0.492648 z M 6.41912,4.639706 q 0,-0.294118 -0.20588,-0.5 L 4.69853,2.617647 q -0.20588,-0.205882 -0.5,-0.205882 -0.28677,0 -0.5,0.198529 L 2.61765,3.683823 q -0.20589,0.205883 -0.20589,0.492648 0,0.294117 0.20589,0.499999 l 1.52941,1.529412 q 0.19853,0.19853 0.5,0.19853 0.30882,0 0.52941,-0.227942 Q 5.15437,6.15441 5.03676,6.040441 4.91912,5.92647 4.87868,5.882353 4.83828,5.838233 4.76838,5.742647 q -0.0698,-0.09559 -0.0956,-0.1875 -0.0257,-0.09191 -0.0257,-0.202206 0,-0.294117 0.20588,-0.5 0.20588,-0.205882 0.5,-0.205882 0.1103,0 0.20221,0.02573 0.0919,0.02573 0.1875,0.09559 0.0956,0.06985 0.1397,0.110294 0.0441,0.04044 0.15809,0.158089 Q 6.15443,5.154409 6.17649,5.176467 6.41914,4.948526 6.41914,4.639703 z M 13,9.823529 q 0,0.882353 -0.625,1.492647 l -1.08088,1.07353 Q 10.68382,13 9.80147,13 q -0.88971,0 -1.5,-0.625 L 6.78676,10.852941 Q 6.17647,10.242647 6.17647,9.360294 q 0,-0.904412 0.64706,-1.536764 L 6.17647,7.176471 Q 5.54412,7.82353 4.64706,7.82353 q -0.88235,0 -1.5,-0.617648 L 1.617647,5.676471 Q 1,5.058824 1,4.176471 1,3.294118 1.625,2.683824 L 2.70588,1.610294 Q 3.31618,1 4.19853,1 q 0.88971,0 1.5,0.625 l 1.51471,1.522059 q 0.61029,0.610294 0.61029,1.492647 0,0.904412 -0.64706,1.536764 L 7.82353,6.823529 Q 8.45588,6.17647 9.35294,6.17647 q 0.88235,0 1.5,0.617648 l 1.52941,1.529411 Q 13,8.941176 13,9.823529 z&quot;/&gt;&lt;/svg&gt;
          &lt;/a&gt;&lt;/h2&gt;

&lt;p&gt;The WebGPU header has a number of “object” types that are defined like this:&lt;/p&gt;

&lt;div class=&quot;language-c highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;k&quot;&gt;typedef&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;struct&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;WGPUBindGroupImpl&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;*&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;WGPUBindGroup&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;WGPU_OBJECT_ATTRIBUTE&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;This gets imported into Swift as an alias for an opaque pointer type, which is… not great:&lt;/p&gt;

&lt;div class=&quot;language-swift highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;kd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;typealias&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;WGPUBindGroup&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;OpaquePointer&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;WebGPU object types are reference counted, and each object type has corresponding &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;AddRef&lt;/code&gt; and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Release&lt;/code&gt; functions to increment and decrement the reference count, like this:&lt;/p&gt;

&lt;div class=&quot;language-c highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;n&quot;&gt;WGPU_EXPORT&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;void&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;wgpuBindGroupAddRef&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;WGPUBindGroup&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;bindGroup&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;WGPU_FUNCTION_ATTRIBUTE&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;WGPU_EXPORT&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;void&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;wgpuBindGroupRelease&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;WGPUBindGroup&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;bindGroup&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;WGPU_FUNCTION_ATTRIBUTE&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Of course, you can use these functions in Swift exactly how you do in C, making sure to balance out calls to &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;AddRef&lt;/code&gt; and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Release&lt;/code&gt;, but then it would be every bit as unsafe as C.&lt;/p&gt;

&lt;p&gt;We can do better with &lt;a href=&quot;https://www.swift.org/documentation/cxx-interop/#shared-reference-types&quot;&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;SWIFT_SHARED_REFERENCE&lt;/code&gt;&lt;/a&gt;. It’s a macro (defined in the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;&amp;lt;swift/bridging&amp;gt;&lt;/code&gt; header) that can turn a reference-counted C type like the above into an automatically reference-counted &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;class&lt;/code&gt; in Swift. Here’s how we would use it in the header:&lt;/p&gt;

&lt;div class=&quot;language-swift highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;n&quot;&gt;typedef&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;struct&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;SWIFT_SHARED_REFERENCE&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;wgpuBindGroupAddRef&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;wgpuBindGroupRelease&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;WGPUBindGroupImpl&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;*&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;WGPUBindGroup&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;WGPU_OBJECT_ATTRIBUTE&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Now, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;WGPUBindGroup&lt;/code&gt; gets imported like this:&lt;/p&gt;

&lt;div class=&quot;language-swift highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;kd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;class&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;WGPUBindGroupImpl&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;kd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;typealias&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;WGPUBindGroup&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;WGPUBindGroupImpl&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;The extra typealias is a little unexpected, but overall this is a huge improvement: Swift is treating &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;WGPUBindGroup&lt;/code&gt; as a class, meaning that it automatically manages retains and releases for you! This is both an ergonomic win (less code to write) and a safety win, because it’s eliminated the possibility of mismanaging these instances.&lt;/p&gt;

&lt;p&gt;There’s one more thing: when dealing with reference-counting APIs, you need to know whether a particular function that returns an object is expecting you to call “release” when you’re done. In the WebGPU header, this information is embedded in a comment:&lt;/p&gt;

&lt;div class=&quot;language-c highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;cm&quot;&gt;/**
 * @returns
 * This value is @ref ReturnedWithOwnership.
 */&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;WGPU_EXPORT&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;WGPUBindGroup&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;wgpuDeviceCreateBindGroup&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;WGPUDevice&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;device&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;WGPUBindGroupDescriptor&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;*&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;descriptor&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;WGPU_FUNCTION_ATTRIBUTE&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;“ReturnedWithOwnership” here means that the result of the call has already been retained one extra time, and the caller is responsible for calling “release” when they are done with it. The &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;&amp;lt;swift/bridging&amp;gt;&lt;/code&gt; header has a &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;SWIFT_RETURNS_RETAINED&lt;/code&gt; macro that expresses this notion. One can use it like this:&lt;/p&gt;

&lt;div class=&quot;language-swift highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;kt&quot;&gt;WGPU_EXPORT&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;WGPUBindGroup&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;wgpuDeviceCreateBindGroup&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;WGPUDevice&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;device&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;WGPUBindGroupDescriptor&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;*&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;descriptor&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;WGPU_FUNCTION_ATTRIBUTE&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;SWIFT_RETURNS_RETAINED&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Now, Swift will balance out the retain that &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;wgpuDeviceCreateBindGroup&lt;/code&gt; has promised to do by performing the extra release once you’re done using the object. Once these annotations are done, we’re all set with a more ergonomic and memory-safe API for this C library. There’s no need to ever call &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;wgpuBindGroupRelease&lt;/code&gt; or &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;wgpuBindGroupAddRef&lt;/code&gt; yourself.&lt;/p&gt;

&lt;p&gt;We’ve hacked up our header again, so let’s undo that and move all of this out to API notes. To turn a type into a foreign reference type, we augment the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Tags&lt;/code&gt; section of our API notes with the same information, but in YAML form:&lt;/p&gt;

&lt;div class=&quot;language-yaml highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;pi&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;Name&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;WGPUBindGroupImpl&lt;/span&gt;
  &lt;span class=&quot;na&quot;&gt;SwiftImportAs&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;reference&lt;/span&gt;
  &lt;span class=&quot;na&quot;&gt;SwiftReleaseOp&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;wgpuBindGroupRelease&lt;/span&gt;
  &lt;span class=&quot;na&quot;&gt;SwiftRetainOp&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;wgpuBindGroupAddRef&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;That makes &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;WGPUBindGroupImpl&lt;/code&gt; import as a class type, with the given retain and release functions. We can express the “returns retained” behavior of the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;wgpuDeviceCreateBindGroup&lt;/code&gt; function like this:&lt;/p&gt;

&lt;div class=&quot;language-yaml highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;na&quot;&gt;Functions&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
&lt;span class=&quot;pi&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;Name&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;wgpuDeviceCreateBindGroup&lt;/span&gt;
  &lt;span class=&quot;na&quot;&gt;SwiftReturnOwnership&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;retained&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;That’s enums and classes, so now let’s tackle… functions.&lt;/p&gt;

&lt;h2 id=&quot;importing-functions&quot; class=&quot;header-with-anchor&quot;&gt;Importing functions &lt;a title=&quot;Permalink for Importing functions section&quot; href=&quot;#importing-functions&quot;&gt;
            &lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt; &lt;svg width=&quot;18px&quot; height=&quot;18px&quot; viewBox=&quot;0 0 14 14&quot; role=&quot;img&quot; focusable=&quot;false&quot; aria-hidden=&quot;true&quot; xmlns=&quot;http://www.w3.org/2000/svg&quot;&gt;&lt;path d=&quot;m 11.58824,9.823529 q 0,-0.294117 -0.20589,-0.499999 L 9.85294,7.794118 q -0.20588,-0.205883 -0.5,-0.205883 -0.30882,0 -0.52941,0.235295 0.0221,0.02206 0.13971,0.136029 0.11764,0.113971 0.15808,0.158088 0.0404,0.04412 0.1103,0.139706 0.0698,0.09559 0.0956,0.1875 0.0257,0.09191 0.0257,0.202206 0,0.294117 -0.20588,0.5 -0.20588,0.205882 -0.5,0.205882 -0.1103,0 -0.20221,-0.02573 Q 8.35293,9.301471 8.25733,9.231621 8.16173,9.161771 8.11763,9.121327 8.07353,9.080887 7.95954,8.963238 7.84557,8.845591 7.82351,8.823533 7.58086,9.051474 7.58086,9.360297 q 0,0.294118 0.20588,0.5 l 1.51471,1.522059 q 0.19853,0.19853 0.5,0.19853 0.29412,0 0.5,-0.191177 l 1.08088,-1.073529 q 0.20589,-0.205883 0.20589,-0.492648 z M 6.41912,4.639706 q 0,-0.294118 -0.20588,-0.5 L 4.69853,2.617647 q -0.20588,-0.205882 -0.5,-0.205882 -0.28677,0 -0.5,0.198529 L 2.61765,3.683823 q -0.20589,0.205883 -0.20589,0.492648 0,0.294117 0.20589,0.499999 l 1.52941,1.529412 q 0.19853,0.19853 0.5,0.19853 0.30882,0 0.52941,-0.227942 Q 5.15437,6.15441 5.03676,6.040441 4.91912,5.92647 4.87868,5.882353 4.83828,5.838233 4.76838,5.742647 q -0.0698,-0.09559 -0.0956,-0.1875 -0.0257,-0.09191 -0.0257,-0.202206 0,-0.294117 0.20588,-0.5 0.20588,-0.205882 0.5,-0.205882 0.1103,0 0.20221,0.02573 0.0919,0.02573 0.1875,0.09559 0.0956,0.06985 0.1397,0.110294 0.0441,0.04044 0.15809,0.158089 Q 6.15443,5.154409 6.17649,5.176467 6.41914,4.948526 6.41914,4.639703 z M 13,9.823529 q 0,0.882353 -0.625,1.492647 l -1.08088,1.07353 Q 10.68382,13 9.80147,13 q -0.88971,0 -1.5,-0.625 L 6.78676,10.852941 Q 6.17647,10.242647 6.17647,9.360294 q 0,-0.904412 0.64706,-1.536764 L 6.17647,7.176471 Q 5.54412,7.82353 4.64706,7.82353 q -0.88235,0 -1.5,-0.617648 L 1.617647,5.676471 Q 1,5.058824 1,4.176471 1,3.294118 1.625,2.683824 L 2.70588,1.610294 Q 3.31618,1 4.19853,1 q 0.88971,0 1.5,0.625 l 1.51471,1.522059 q 0.61029,0.610294 0.61029,1.492647 0,0.904412 -0.64706,1.536764 L 7.82353,6.823529 Q 8.45588,6.17647 9.35294,6.17647 q 0.88235,0 1.5,0.617648 l 1.52941,1.529411 Q 13,8.941176 13,9.823529 z&quot;/&gt;&lt;/svg&gt;
          &lt;/a&gt;&lt;/h2&gt;

&lt;p&gt;A typical function from &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;webgpu.h&lt;/code&gt;, like this:&lt;/p&gt;

&lt;div class=&quot;language-c highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;n&quot;&gt;WGPU_EXPORT&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;void&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;wgpuQueueWriteBuffer&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;WGPUQueue&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;queue&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;WGPUBuffer&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;buffer&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;uint64_t&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;bufferOffset&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; 
    &lt;span class=&quot;kt&quot;&gt;void&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;*&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;data&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;size_t&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;size&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;WGPU_FUNCTION_ATTRIBUTE&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;will come into Swift like this:&lt;/p&gt;

&lt;div class=&quot;language-swift highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;kd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;func&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;wgpuQueueWriteBuffer&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;_&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;queue&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;WGPUQueue&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;!&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;_&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;buffer&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;WGPUBuffer&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;!&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;_&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;bufferOffset&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;UInt64&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;_&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;data&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;UnsafeRawPointer&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;!&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;_&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;size&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;Int&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Note that &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;_&lt;/code&gt; on each parameter, which means that we won’t use argument labels for anything when we call it:&lt;/p&gt;

&lt;div class=&quot;language-swift highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nf&quot;&gt;wgpuQueueWriteBuffer&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;myQueue&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;buffer&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;position&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;dataToWrite&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;bytesToWrite&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;That matches C, but it isn’t as clear as it could be in Swift. Let’s clean this up by providing a better name in Swift that includes argument labels. We can do so using &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;SWIFT_NAME&lt;/code&gt; (also in &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;&amp;lt;swift/bridging&amp;gt;&lt;/code&gt;), like this:&lt;/p&gt;

&lt;div class=&quot;language-c highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;n&quot;&gt;WGPU_EXPORT&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;void&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;wgpuQueueWriteBuffer&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;
      &lt;span class=&quot;n&quot;&gt;WGPUQueue&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;queue&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;WGPUBuffer&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;buffer&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;uint64_t&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;bufferOffset&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
      &lt;span class=&quot;kt&quot;&gt;void&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;*&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;data&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;size_t&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;size&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;WGPU_FUNCTION_ATTRIBUTE&lt;/span&gt; 
    &lt;span class=&quot;n&quot;&gt;SWIFT_NAME&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;wgpuQueueWriteBuffer(_:buffer:bufferOffset:data:size:)&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Within the parentheses, we have each of the argument labels that we want (or &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;_&lt;/code&gt; meaning “no label”), each followed by a &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;:&lt;/code&gt;. This is how one describes a full function name in Swift. Once we’ve made this change to the Swift name, the C function comes into Swift with argument labels, like this:&lt;/p&gt;

&lt;div class=&quot;language-swift highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;kd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;func&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;wgpuQueueWriteBuffer&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;_&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;queue&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;WGPUQueue&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;!&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;buffer&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;WGPUBuffer&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;!&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;bufferOffset&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;UInt64&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;data&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;UnsafeRawPointer&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;!&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;size&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;Int&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;That makes the call site more clear and self-documenting:&lt;/p&gt;

&lt;div class=&quot;language-swift highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nf&quot;&gt;wgpuQueueWriteBuffer&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;myQueue&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;buffer&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;buffer&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;offset&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;position&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;data&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;dataToWrite&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;size&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;bytesToWrite&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h3 id=&quot;importing-functions-as-methods&quot; class=&quot;header-with-anchor&quot;&gt;Importing functions as methods &lt;a title=&quot;Permalink for Importing functions as methods section&quot; href=&quot;#importing-functions-as-methods&quot;&gt;
            &lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt; &lt;svg width=&quot;18px&quot; height=&quot;18px&quot; viewBox=&quot;0 0 14 14&quot; role=&quot;img&quot; focusable=&quot;false&quot; aria-hidden=&quot;true&quot; xmlns=&quot;http://www.w3.org/2000/svg&quot;&gt;&lt;path d=&quot;m 11.58824,9.823529 q 0,-0.294117 -0.20589,-0.499999 L 9.85294,7.794118 q -0.20588,-0.205883 -0.5,-0.205883 -0.30882,0 -0.52941,0.235295 0.0221,0.02206 0.13971,0.136029 0.11764,0.113971 0.15808,0.158088 0.0404,0.04412 0.1103,0.139706 0.0698,0.09559 0.0956,0.1875 0.0257,0.09191 0.0257,0.202206 0,0.294117 -0.20588,0.5 -0.20588,0.205882 -0.5,0.205882 -0.1103,0 -0.20221,-0.02573 Q 8.35293,9.301471 8.25733,9.231621 8.16173,9.161771 8.11763,9.121327 8.07353,9.080887 7.95954,8.963238 7.84557,8.845591 7.82351,8.823533 7.58086,9.051474 7.58086,9.360297 q 0,0.294118 0.20588,0.5 l 1.51471,1.522059 q 0.19853,0.19853 0.5,0.19853 0.29412,0 0.5,-0.191177 l 1.08088,-1.073529 q 0.20589,-0.205883 0.20589,-0.492648 z M 6.41912,4.639706 q 0,-0.294118 -0.20588,-0.5 L 4.69853,2.617647 q -0.20588,-0.205882 -0.5,-0.205882 -0.28677,0 -0.5,0.198529 L 2.61765,3.683823 q -0.20589,0.205883 -0.20589,0.492648 0,0.294117 0.20589,0.499999 l 1.52941,1.529412 q 0.19853,0.19853 0.5,0.19853 0.30882,0 0.52941,-0.227942 Q 5.15437,6.15441 5.03676,6.040441 4.91912,5.92647 4.87868,5.882353 4.83828,5.838233 4.76838,5.742647 q -0.0698,-0.09559 -0.0956,-0.1875 -0.0257,-0.09191 -0.0257,-0.202206 0,-0.294117 0.20588,-0.5 0.20588,-0.205882 0.5,-0.205882 0.1103,0 0.20221,0.02573 0.0919,0.02573 0.1875,0.09559 0.0956,0.06985 0.1397,0.110294 0.0441,0.04044 0.15809,0.158089 Q 6.15443,5.154409 6.17649,5.176467 6.41914,4.948526 6.41914,4.639703 z M 13,9.823529 q 0,0.882353 -0.625,1.492647 l -1.08088,1.07353 Q 10.68382,13 9.80147,13 q -0.88971,0 -1.5,-0.625 L 6.78676,10.852941 Q 6.17647,10.242647 6.17647,9.360294 q 0,-0.904412 0.64706,-1.536764 L 6.17647,7.176471 Q 5.54412,7.82353 4.64706,7.82353 q -0.88235,0 -1.5,-0.617648 L 1.617647,5.676471 Q 1,5.058824 1,4.176471 1,3.294118 1.625,2.683824 L 2.70588,1.610294 Q 3.31618,1 4.19853,1 q 0.88971,0 1.5,0.625 l 1.51471,1.522059 q 0.61029,0.610294 0.61029,1.492647 0,0.904412 -0.64706,1.536764 L 7.82353,6.823529 Q 8.45588,6.17647 9.35294,6.17647 q 0.88235,0 1.5,0.617648 l 1.52941,1.529411 Q 13,8.941176 13,9.823529 z&quot;/&gt;&lt;/svg&gt;
          &lt;/a&gt;&lt;/h3&gt;

&lt;p&gt;There is more usable structure in this API. Note that the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;wgpuQueueWriteBuffer&lt;/code&gt; function takes, as its first argument, an instance of &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;WGPUQueue&lt;/code&gt;. Most of the C functions in &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;WebGPU.h&lt;/code&gt; are like this, because these are effectively functions that operate on their first argument. In a language that has methods, they would be methods. Swift has methods, so let’s make them methods!&lt;/p&gt;

&lt;div class=&quot;language-c highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;n&quot;&gt;WGPU_EXPORT&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;void&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;wgpuQueueWriteBuffer&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;
      &lt;span class=&quot;n&quot;&gt;WGPUQueue&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;queue&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;WGPUBuffer&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;buffer&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;uint64_t&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;bufferOffset&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;void&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;*&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;data&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;size_t&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;size&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; 
  &lt;span class=&quot;n&quot;&gt;WGPU_FUNCTION_ATTRIBUTE&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;SWIFT_NAME&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;WGPUQueueImpl.writeBuffer(self:buffer:bufferOffset:data:size:)&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;There are three things to notice about this &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;SWIFT_NAME&lt;/code&gt; string:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;It starts with &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;WGPUQueueImpl.&lt;/code&gt;, which tells Swift to make this function a member inside &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;WGPUQueueImpl&lt;/code&gt;.&lt;/li&gt;
  &lt;li&gt;Let’s change the function name to &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;writeBuffer&lt;/code&gt;, because we no longer need the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;wgpuQueue&lt;/code&gt; prefix to distinguish it from other “write buffer” operations on other types.&lt;/li&gt;
  &lt;li&gt;The name of the first argument in parentheses is &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;self&lt;/code&gt;, which indicates that the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;self&lt;/code&gt; argument (in Swift) should be passed as that positional argument to the C function. The other arguments are passed in-order.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Note that this also requires &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;WGPUQueue(Impl)&lt;/code&gt; to be imported as a &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;class&lt;/code&gt;, as we did earlier for &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;WGPUBindGroupImpl&lt;/code&gt;. Once we’ve done so, we get a much-nicer Swift API:&lt;/p&gt;

&lt;div class=&quot;language-swift highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;kd&quot;&gt;extension&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;WGPUQueueImpl&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
  &lt;span class=&quot;kd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;func&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;writeBuffer&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;buffer&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;WGPUBuffer&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;!&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;bufferOffset&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;UInt64&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;data&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;UnsafeRawPointer&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;!&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;size&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;Int&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;We’ve hacked up the header again, but didn’t have to. In &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;WebGPU.apinotes&lt;/code&gt;, you can put a &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;SwiftName&lt;/code&gt; attribute on any entity. For &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;wgpuQueueWriteBuffer&lt;/code&gt;, it would look like this (in the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Functions&lt;/code&gt; section):&lt;/p&gt;

&lt;div class=&quot;language-yaml highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;pi&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;Name&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;wgpuQueueWriteBuffer&lt;/span&gt;
  &lt;span class=&quot;na&quot;&gt;SwiftName&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;WGPUQueueImpl.writeBuffer(self:buffer:bufferOffset:data:size:)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h3 id=&quot;importing-functions-as-properties&quot; class=&quot;header-with-anchor&quot;&gt;Importing functions as properties &lt;a title=&quot;Permalink for Importing functions as properties section&quot; href=&quot;#importing-functions-as-properties&quot;&gt;
            &lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt; &lt;svg width=&quot;18px&quot; height=&quot;18px&quot; viewBox=&quot;0 0 14 14&quot; role=&quot;img&quot; focusable=&quot;false&quot; aria-hidden=&quot;true&quot; xmlns=&quot;http://www.w3.org/2000/svg&quot;&gt;&lt;path d=&quot;m 11.58824,9.823529 q 0,-0.294117 -0.20589,-0.499999 L 9.85294,7.794118 q -0.20588,-0.205883 -0.5,-0.205883 -0.30882,0 -0.52941,0.235295 0.0221,0.02206 0.13971,0.136029 0.11764,0.113971 0.15808,0.158088 0.0404,0.04412 0.1103,0.139706 0.0698,0.09559 0.0956,0.1875 0.0257,0.09191 0.0257,0.202206 0,0.294117 -0.20588,0.5 -0.20588,0.205882 -0.5,0.205882 -0.1103,0 -0.20221,-0.02573 Q 8.35293,9.301471 8.25733,9.231621 8.16173,9.161771 8.11763,9.121327 8.07353,9.080887 7.95954,8.963238 7.84557,8.845591 7.82351,8.823533 7.58086,9.051474 7.58086,9.360297 q 0,0.294118 0.20588,0.5 l 1.51471,1.522059 q 0.19853,0.19853 0.5,0.19853 0.29412,0 0.5,-0.191177 l 1.08088,-1.073529 q 0.20589,-0.205883 0.20589,-0.492648 z M 6.41912,4.639706 q 0,-0.294118 -0.20588,-0.5 L 4.69853,2.617647 q -0.20588,-0.205882 -0.5,-0.205882 -0.28677,0 -0.5,0.198529 L 2.61765,3.683823 q -0.20589,0.205883 -0.20589,0.492648 0,0.294117 0.20589,0.499999 l 1.52941,1.529412 q 0.19853,0.19853 0.5,0.19853 0.30882,0 0.52941,-0.227942 Q 5.15437,6.15441 5.03676,6.040441 4.91912,5.92647 4.87868,5.882353 4.83828,5.838233 4.76838,5.742647 q -0.0698,-0.09559 -0.0956,-0.1875 -0.0257,-0.09191 -0.0257,-0.202206 0,-0.294117 0.20588,-0.5 0.20588,-0.205882 0.5,-0.205882 0.1103,0 0.20221,0.02573 0.0919,0.02573 0.1875,0.09559 0.0956,0.06985 0.1397,0.110294 0.0441,0.04044 0.15809,0.158089 Q 6.15443,5.154409 6.17649,5.176467 6.41914,4.948526 6.41914,4.639703 z M 13,9.823529 q 0,0.882353 -0.625,1.492647 l -1.08088,1.07353 Q 10.68382,13 9.80147,13 q -0.88971,0 -1.5,-0.625 L 6.78676,10.852941 Q 6.17647,10.242647 6.17647,9.360294 q 0,-0.904412 0.64706,-1.536764 L 6.17647,7.176471 Q 5.54412,7.82353 4.64706,7.82353 q -0.88235,0 -1.5,-0.617648 L 1.617647,5.676471 Q 1,5.058824 1,4.176471 1,3.294118 1.625,2.683824 L 2.70588,1.610294 Q 3.31618,1 4.19853,1 q 0.88971,0 1.5,0.625 l 1.51471,1.522059 q 0.61029,0.610294 0.61029,1.492647 0,0.904412 -0.64706,1.536764 L 7.82353,6.823529 Q 8.45588,6.17647 9.35294,6.17647 q 0.88235,0 1.5,0.617648 l 1.52941,1.529411 Q 13,8.941176 13,9.823529 z&quot;/&gt;&lt;/svg&gt;
          &lt;/a&gt;&lt;/h3&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;WebGPU.h&lt;/code&gt; has a number of &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Get&lt;/code&gt; functions that produce information about some aspect of a type. Here are two for the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;WGPUQuerySet&lt;/code&gt; type:&lt;/p&gt;

&lt;div class=&quot;language-c highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;n&quot;&gt;WGPU_EXPORT&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;uint32_t&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;wgpuQuerySetGetCount&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;WGPUQuerySet&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;querySet&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;WGPU_FUNCTION_ATTRIBUTE&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;WGPU_EXPORT&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;WGPUQueryType&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;wgpuQuerySetGetType&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;WGPUQuerySet&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;querySet&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;WGPU_FUNCTION_ATTRIBUTE&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;With the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;SWIFT_NAME&lt;/code&gt; tricks above, we can turn these into “get” methods on &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;WGPUQuerySet&lt;/code&gt;, like this:&lt;/p&gt;

&lt;div class=&quot;language-swift highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;kd&quot;&gt;extension&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;WGPUQuerySetImpl&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;kd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;func&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;getCount&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;UInt32&lt;/span&gt;
    &lt;span class=&quot;kd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;func&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;getType&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;WGPUQueryType&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;That’s okay, but it’s not what you’d do in Swift. Let’s go one step further and turn them into read-only computed properties. To do so, use the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;getter:&lt;/code&gt; prefix on the Swift name we define. We’ll skip ahead to the YAML form that goes into API notes:&lt;/p&gt;

&lt;div class=&quot;language-yaml highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;pi&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;Name&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;wgpuQuerySetGetCount&lt;/span&gt;
  &lt;span class=&quot;na&quot;&gt;SwiftName&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;getter:WGPUQuerySetImpl.count(self:)&lt;/span&gt;
&lt;span class=&quot;pi&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;Name&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;wgpuQuerySetGetType&lt;/span&gt;
  &lt;span class=&quot;na&quot;&gt;SwiftName&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;getter:WGPUQuerySetImpl.type(self:)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;And now, we arrive at a nice Swift API:&lt;/p&gt;

&lt;div class=&quot;language-swift highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;kd&quot;&gt;extension&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;WGPUQuerySetImpl&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;kd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;count&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;UInt32&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;get&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;kd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;type&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;WGPUQueryType&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;get&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h3 id=&quot;importing-functions-as-initializers&quot; class=&quot;header-with-anchor&quot;&gt;Importing functions as initializers &lt;a title=&quot;Permalink for Importing functions as initializers section&quot; href=&quot;#importing-functions-as-initializers&quot;&gt;
            &lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt; &lt;svg width=&quot;18px&quot; height=&quot;18px&quot; viewBox=&quot;0 0 14 14&quot; role=&quot;img&quot; focusable=&quot;false&quot; aria-hidden=&quot;true&quot; xmlns=&quot;http://www.w3.org/2000/svg&quot;&gt;&lt;path d=&quot;m 11.58824,9.823529 q 0,-0.294117 -0.20589,-0.499999 L 9.85294,7.794118 q -0.20588,-0.205883 -0.5,-0.205883 -0.30882,0 -0.52941,0.235295 0.0221,0.02206 0.13971,0.136029 0.11764,0.113971 0.15808,0.158088 0.0404,0.04412 0.1103,0.139706 0.0698,0.09559 0.0956,0.1875 0.0257,0.09191 0.0257,0.202206 0,0.294117 -0.20588,0.5 -0.20588,0.205882 -0.5,0.205882 -0.1103,0 -0.20221,-0.02573 Q 8.35293,9.301471 8.25733,9.231621 8.16173,9.161771 8.11763,9.121327 8.07353,9.080887 7.95954,8.963238 7.84557,8.845591 7.82351,8.823533 7.58086,9.051474 7.58086,9.360297 q 0,0.294118 0.20588,0.5 l 1.51471,1.522059 q 0.19853,0.19853 0.5,0.19853 0.29412,0 0.5,-0.191177 l 1.08088,-1.073529 q 0.20589,-0.205883 0.20589,-0.492648 z M 6.41912,4.639706 q 0,-0.294118 -0.20588,-0.5 L 4.69853,2.617647 q -0.20588,-0.205882 -0.5,-0.205882 -0.28677,0 -0.5,0.198529 L 2.61765,3.683823 q -0.20589,0.205883 -0.20589,0.492648 0,0.294117 0.20589,0.499999 l 1.52941,1.529412 q 0.19853,0.19853 0.5,0.19853 0.30882,0 0.52941,-0.227942 Q 5.15437,6.15441 5.03676,6.040441 4.91912,5.92647 4.87868,5.882353 4.83828,5.838233 4.76838,5.742647 q -0.0698,-0.09559 -0.0956,-0.1875 -0.0257,-0.09191 -0.0257,-0.202206 0,-0.294117 0.20588,-0.5 0.20588,-0.205882 0.5,-0.205882 0.1103,0 0.20221,0.02573 0.0919,0.02573 0.1875,0.09559 0.0956,0.06985 0.1397,0.110294 0.0441,0.04044 0.15809,0.158089 Q 6.15443,5.154409 6.17649,5.176467 6.41914,4.948526 6.41914,4.639703 z M 13,9.823529 q 0,0.882353 -0.625,1.492647 l -1.08088,1.07353 Q 10.68382,13 9.80147,13 q -0.88971,0 -1.5,-0.625 L 6.78676,10.852941 Q 6.17647,10.242647 6.17647,9.360294 q 0,-0.904412 0.64706,-1.536764 L 6.17647,7.176471 Q 5.54412,7.82353 4.64706,7.82353 q -0.88235,0 -1.5,-0.617648 L 1.617647,5.676471 Q 1,5.058824 1,4.176471 1,3.294118 1.625,2.683824 L 2.70588,1.610294 Q 3.31618,1 4.19853,1 q 0.88971,0 1.5,0.625 l 1.51471,1.522059 q 0.61029,0.610294 0.61029,1.492647 0,0.904412 -0.64706,1.536764 L 7.82353,6.823529 Q 8.45588,6.17647 9.35294,6.17647 q 0.88235,0 1.5,0.617648 l 1.52941,1.529411 Q 13,8.941176 13,9.823529 z&quot;/&gt;&lt;/svg&gt;
          &lt;/a&gt;&lt;/h3&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;SWIFT_NAME&lt;/code&gt; can also be used to import a function that returns a new instance as a Swift initializer. For example, this function creates a new &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;WGPUInstance&lt;/code&gt; (which we assume is getting imported as a &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;class&lt;/code&gt; like we’ve been doing above):&lt;/p&gt;

&lt;div class=&quot;language-c highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;cm&quot;&gt;/**
 * Create a WGPUInstance
 *
 * @returns
 * This value is @ref ReturnedWithOwnership.
 */&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;WGPU_EXPORT&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;WGPUInstance&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;wgpuCreateInstance&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;WGPU_NULLABLE&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;WGPUInstanceDescriptor&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;*&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;descriptor&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;WGPU_FUNCTION_ATTRIBUTE&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;We can turn this into a Swift initializer, which is used to create a new object, using the same &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;SWIFT_NAME&lt;/code&gt; syntax but where the method name is &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;init&lt;/code&gt;. Here is the YAML form that goes into API notes:&lt;/p&gt;

&lt;div class=&quot;language-yaml highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;pi&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;Name&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;wgpuCreateInstance&lt;/span&gt;
  &lt;span class=&quot;na&quot;&gt;SwiftReturnOwnership&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;retained&lt;/span&gt;
  &lt;span class=&quot;na&quot;&gt;SwiftName&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;WGPUInstanceImpl.init(descriptor:)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;and here is the resulting Swift initializer:&lt;/p&gt;

&lt;div class=&quot;language-swift highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;kd&quot;&gt;extension&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;WGPUInstanceImpl&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;cm&quot;&gt;/**
     * Create a WGPUInstance
     *
     * @returns
     * This value is @ref ReturnedWithOwnership.
     */&lt;/span&gt;
    &lt;span class=&quot;kd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;cm&quot;&gt;/*not inherited*/&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;init&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;!&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;descriptor&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;UnsafePointer&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;WGPUInstanceDescriptor&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;!&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Now, one can create a new &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;WGPUInstance&lt;/code&gt; with the normal object-creation syntax, e.g.,&lt;/p&gt;

&lt;div class=&quot;language-swift highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;k&quot;&gt;let&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;instance&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;WGPUInstance&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;descriptor&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;myDescriptor&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h2 id=&quot;another-boolean-type&quot; class=&quot;header-with-anchor&quot;&gt;Another Boolean type? &lt;a title=&quot;Permalink for Another Boolean type? section&quot; href=&quot;#another-boolean-type&quot;&gt;
            &lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt; &lt;svg width=&quot;18px&quot; height=&quot;18px&quot; viewBox=&quot;0 0 14 14&quot; role=&quot;img&quot; focusable=&quot;false&quot; aria-hidden=&quot;true&quot; xmlns=&quot;http://www.w3.org/2000/svg&quot;&gt;&lt;path d=&quot;m 11.58824,9.823529 q 0,-0.294117 -0.20589,-0.499999 L 9.85294,7.794118 q -0.20588,-0.205883 -0.5,-0.205883 -0.30882,0 -0.52941,0.235295 0.0221,0.02206 0.13971,0.136029 0.11764,0.113971 0.15808,0.158088 0.0404,0.04412 0.1103,0.139706 0.0698,0.09559 0.0956,0.1875 0.0257,0.09191 0.0257,0.202206 0,0.294117 -0.20588,0.5 -0.20588,0.205882 -0.5,0.205882 -0.1103,0 -0.20221,-0.02573 Q 8.35293,9.301471 8.25733,9.231621 8.16173,9.161771 8.11763,9.121327 8.07353,9.080887 7.95954,8.963238 7.84557,8.845591 7.82351,8.823533 7.58086,9.051474 7.58086,9.360297 q 0,0.294118 0.20588,0.5 l 1.51471,1.522059 q 0.19853,0.19853 0.5,0.19853 0.29412,0 0.5,-0.191177 l 1.08088,-1.073529 q 0.20589,-0.205883 0.20589,-0.492648 z M 6.41912,4.639706 q 0,-0.294118 -0.20588,-0.5 L 4.69853,2.617647 q -0.20588,-0.205882 -0.5,-0.205882 -0.28677,0 -0.5,0.198529 L 2.61765,3.683823 q -0.20589,0.205883 -0.20589,0.492648 0,0.294117 0.20589,0.499999 l 1.52941,1.529412 q 0.19853,0.19853 0.5,0.19853 0.30882,0 0.52941,-0.227942 Q 5.15437,6.15441 5.03676,6.040441 4.91912,5.92647 4.87868,5.882353 4.83828,5.838233 4.76838,5.742647 q -0.0698,-0.09559 -0.0956,-0.1875 -0.0257,-0.09191 -0.0257,-0.202206 0,-0.294117 0.20588,-0.5 0.20588,-0.205882 0.5,-0.205882 0.1103,0 0.20221,0.02573 0.0919,0.02573 0.1875,0.09559 0.0956,0.06985 0.1397,0.110294 0.0441,0.04044 0.15809,0.158089 Q 6.15443,5.154409 6.17649,5.176467 6.41914,4.948526 6.41914,4.639703 z M 13,9.823529 q 0,0.882353 -0.625,1.492647 l -1.08088,1.07353 Q 10.68382,13 9.80147,13 q -0.88971,0 -1.5,-0.625 L 6.78676,10.852941 Q 6.17647,10.242647 6.17647,9.360294 q 0,-0.904412 0.64706,-1.536764 L 6.17647,7.176471 Q 5.54412,7.82353 4.64706,7.82353 q -0.88235,0 -1.5,-0.617648 L 1.617647,5.676471 Q 1,5.058824 1,4.176471 1,3.294118 1.625,2.683824 L 2.70588,1.610294 Q 3.31618,1 4.19853,1 q 0.88971,0 1.5,0.625 l 1.51471,1.522059 q 0.61029,0.610294 0.61029,1.492647 0,0.904412 -0.64706,1.536764 L 7.82353,6.823529 Q 8.45588,6.17647 9.35294,6.17647 q 0.88235,0 1.5,0.617648 l 1.52941,1.529411 Q 13,8.941176 13,9.823529 z&quot;/&gt;&lt;/svg&gt;
          &lt;/a&gt;&lt;/h2&gt;

&lt;p&gt;The WebGPU header defines its own Boolean type. I wish everyone would use C99’s &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;_Bool&lt;/code&gt; and be done with it, but alas, here are the definitions for WebGPUs Boolean types:&lt;/p&gt;

&lt;div class=&quot;language-c highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;cp&quot;&gt;#define WGPU_TRUE (UINT32_C(1))
#define WGPU_FALSE (UINT32_C(0))
&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;typedef&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;uint32_t&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;WGPUBool&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;This means that &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;WGPUBool&lt;/code&gt; will come in to Swift as a &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;UInt32&lt;/code&gt;. The two macros aren’t available in Swift at all: they’re “too complicated” to be recognized as integral constants. Even if they were available in Swift, it still wouldn’t be great because we want to use &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;true&lt;/code&gt; and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;false&lt;/code&gt; for Boolean values in Swift, not &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;WGPU_TRUE&lt;/code&gt; and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;WGPU_FALSE&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;To make &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;WGPUBool&lt;/code&gt; easier to use from Swift, we’re first going to map that typedef to its own &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;struct&lt;/code&gt; that stores the underlying &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;UInt32&lt;/code&gt;, giving it an identity separate from &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;UInt32&lt;/code&gt;. We can do this using a &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;SwiftWrapper&lt;/code&gt; API note within the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Typedefs&lt;/code&gt; section of the file, like this:&lt;/p&gt;

&lt;div class=&quot;language-yaml highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;pi&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;Name&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;WGPUBool&lt;/span&gt;
  &lt;span class=&quot;na&quot;&gt;SwiftWrapper&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;struct&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Now, we get &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;WGPUBool&lt;/code&gt; imported like this:&lt;/p&gt;

&lt;div class=&quot;language-swift highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;kd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;struct&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;WGPUBool&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;Hashable&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;Equatable&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;RawRepresentable&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;kd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;init&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;_&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;rawValue&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;UInt32&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;kd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;init&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;rawValue&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;UInt32&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;To be able to use &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;true&lt;/code&gt; and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;false&lt;/code&gt; literals with this new &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;WGPUBool&lt;/code&gt;, we can write a little bit of Swift code that makes this type conform to the &lt;a href=&quot;https://developer.apple.com/documentation/swift/expressiblebybooleanliteral&quot;&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;ExpressibleByBooleanLiteral&lt;/code&gt;&lt;/a&gt; protocol, like this:&lt;/p&gt;

&lt;div class=&quot;language-swift highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;kd&quot;&gt;extension&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;WGPUBool&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;ExpressibleByBooleanLiteral&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
  &lt;span class=&quot;nf&quot;&gt;init&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;booleanLiteral&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;value&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;Bool&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;self&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;init&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;rawValue&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;value&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;?&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;That’s it! Better type safety (you cannot confuse a &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;WGPUBool&lt;/code&gt; with any other integer value) and the convenience of Boolean literals in Swift.&lt;/p&gt;

&lt;h2 id=&quot;option-sets&quot; class=&quot;header-with-anchor&quot;&gt;Option sets &lt;a title=&quot;Permalink for Option sets section&quot; href=&quot;#option-sets&quot;&gt;
            &lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt; &lt;svg width=&quot;18px&quot; height=&quot;18px&quot; viewBox=&quot;0 0 14 14&quot; role=&quot;img&quot; focusable=&quot;false&quot; aria-hidden=&quot;true&quot; xmlns=&quot;http://www.w3.org/2000/svg&quot;&gt;&lt;path d=&quot;m 11.58824,9.823529 q 0,-0.294117 -0.20589,-0.499999 L 9.85294,7.794118 q -0.20588,-0.205883 -0.5,-0.205883 -0.30882,0 -0.52941,0.235295 0.0221,0.02206 0.13971,0.136029 0.11764,0.113971 0.15808,0.158088 0.0404,0.04412 0.1103,0.139706 0.0698,0.09559 0.0956,0.1875 0.0257,0.09191 0.0257,0.202206 0,0.294117 -0.20588,0.5 -0.20588,0.205882 -0.5,0.205882 -0.1103,0 -0.20221,-0.02573 Q 8.35293,9.301471 8.25733,9.231621 8.16173,9.161771 8.11763,9.121327 8.07353,9.080887 7.95954,8.963238 7.84557,8.845591 7.82351,8.823533 7.58086,9.051474 7.58086,9.360297 q 0,0.294118 0.20588,0.5 l 1.51471,1.522059 q 0.19853,0.19853 0.5,0.19853 0.29412,0 0.5,-0.191177 l 1.08088,-1.073529 q 0.20589,-0.205883 0.20589,-0.492648 z M 6.41912,4.639706 q 0,-0.294118 -0.20588,-0.5 L 4.69853,2.617647 q -0.20588,-0.205882 -0.5,-0.205882 -0.28677,0 -0.5,0.198529 L 2.61765,3.683823 q -0.20589,0.205883 -0.20589,0.492648 0,0.294117 0.20589,0.499999 l 1.52941,1.529412 q 0.19853,0.19853 0.5,0.19853 0.30882,0 0.52941,-0.227942 Q 5.15437,6.15441 5.03676,6.040441 4.91912,5.92647 4.87868,5.882353 4.83828,5.838233 4.76838,5.742647 q -0.0698,-0.09559 -0.0956,-0.1875 -0.0257,-0.09191 -0.0257,-0.202206 0,-0.294117 0.20588,-0.5 0.20588,-0.205882 0.5,-0.205882 0.1103,0 0.20221,0.02573 0.0919,0.02573 0.1875,0.09559 0.0956,0.06985 0.1397,0.110294 0.0441,0.04044 0.15809,0.158089 Q 6.15443,5.154409 6.17649,5.176467 6.41914,4.948526 6.41914,4.639703 z M 13,9.823529 q 0,0.882353 -0.625,1.492647 l -1.08088,1.07353 Q 10.68382,13 9.80147,13 q -0.88971,0 -1.5,-0.625 L 6.78676,10.852941 Q 6.17647,10.242647 6.17647,9.360294 q 0,-0.904412 0.64706,-1.536764 L 6.17647,7.176471 Q 5.54412,7.82353 4.64706,7.82353 q -0.88235,0 -1.5,-0.617648 L 1.617647,5.676471 Q 1,5.058824 1,4.176471 1,3.294118 1.625,2.683824 L 2.70588,1.610294 Q 3.31618,1 4.19853,1 q 0.88971,0 1.5,0.625 l 1.51471,1.522059 q 0.61029,0.610294 0.61029,1.492647 0,0.904412 -0.64706,1.536764 L 7.82353,6.823529 Q 8.45588,6.17647 9.35294,6.17647 q 0.88235,0 1.5,0.617648 l 1.52941,1.529411 Q 13,8.941176 13,9.823529 z&quot;/&gt;&lt;/svg&gt;
          &lt;/a&gt;&lt;/h2&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;webgpu.h&lt;/code&gt; describes a set of flags using a &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;typedef&lt;/code&gt; of the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;WGPUFlags&lt;/code&gt; type (a 64-bit unsigned integer) along with a set of global constants for the different flag values. For example, here is the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;WGPUBufferUsage&lt;/code&gt; flag type and some of its constants:&lt;/p&gt;

&lt;div class=&quot;language-c highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;k&quot;&gt;typedef&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;WGPUFlags&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;WGPUBufferUsage&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;static&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;WGPUBufferUsage&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;WGPUBufferUsage_MapRead&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;mh&quot;&gt;0x0000000000000001&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;static&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;WGPUBufferUsage&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;WGPUBufferUsage_MapWrite&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;mh&quot;&gt;0x0000000000000002&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;static&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;WGPUBufferUsage&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;WGPUBufferUsage_CopySrc&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;mh&quot;&gt;0x0000000000000004&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;static&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;WGPUBufferUsage&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;WGPUBufferUsage_Index&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;mh&quot;&gt;0x0000000000000010&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Similar to what we saw with &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;WGPUBool&lt;/code&gt;, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;WGPUBufferUsage&lt;/code&gt; is a &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;typedef&lt;/code&gt; of a &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;typedef&lt;/code&gt; of a &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;uint64_t&lt;/code&gt;. There’s no type safety in this C API, and one could easily mix up these flags with, say, those of &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;WGPUMapMode&lt;/code&gt;:&lt;/p&gt;

&lt;div class=&quot;language-c highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;k&quot;&gt;typedef&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;WGPUFlags&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;WGPUMapMode&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;static&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;WGPUMapMode&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;WGPUMapMode_Read&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;mh&quot;&gt;0x0000000000000001&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;static&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;WGPUMapMode&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;WGPUMapMode_Write&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;mh&quot;&gt;0x0000000000000002&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;We can do better, by layering more structure for the Swift version of this API using the same &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;SwiftWrapper&lt;/code&gt; approach from &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;WGPUBool&lt;/code&gt;. This goes into the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Typedefs&lt;/code&gt; section of API notes:&lt;/p&gt;

&lt;div class=&quot;language-yaml highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;na&quot;&gt;Typedefs&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
&lt;span class=&quot;pi&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;Name&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;WGPUBufferUsage&lt;/span&gt;
  &lt;span class=&quot;na&quot;&gt;SwiftWrapper&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;struct&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Now, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;WGPUBufferUsage&lt;/code&gt; comes in as its own &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;struct&lt;/code&gt;:&lt;/p&gt;

&lt;div class=&quot;language-swift highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;kd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;struct&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;WGPUBufferUsage&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;Hashable&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;Equatable&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;RawRepresentable&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;kd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;init&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;_&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;rawValue&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;WGPUFlags&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;kd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;init&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;rawValue&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;WGPUFlags&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;The initializers let you create a &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;WGPUBufferUsage&lt;/code&gt; from a &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;WGPUFlags&lt;/code&gt; value, and there is also a &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;rawValue&lt;/code&gt; property to get a &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;WGPUFlags&lt;/code&gt; value out of a &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;WGPUBufferInstance&lt;/code&gt;, so the raw value is always there… but the default is to be type safe. Additionally, those global constants will come in as members of &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;WGPUBufferUsage&lt;/code&gt;, like this:&lt;/p&gt;

&lt;div class=&quot;language-swift highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;kd&quot;&gt;extension&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;WGPUBufferUsage&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;cm&quot;&gt;/**
     * The buffer can be *mapped* on the CPU side in *read* mode (using @ref WGPUMapMode_Read).
     */&lt;/span&gt;
    &lt;span class=&quot;kd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;static&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;_MapRead&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;WGPUBufferUsage&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;get&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;

    &lt;span class=&quot;cm&quot;&gt;/**
     * The buffer can be *mapped* on the CPU side in *write* mode (using @ref WGPUMapMode_Write).
     *
     * @note This usage is **not** required to set `mappedAtCreation` to `true` in @ref WGPUBufferDescriptor.
     */&lt;/span&gt;
    &lt;span class=&quot;kd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;static&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;_MapWrite&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;WGPUBufferUsage&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;get&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;

    &lt;span class=&quot;cm&quot;&gt;/**
     * The buffer can be used as the *source* of a GPU-side copy operation.
     */&lt;/span&gt;
    &lt;span class=&quot;kd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;static&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;_CopySrc&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;WGPUBufferUsage&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;get&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;

    &lt;span class=&quot;cm&quot;&gt;/**
     * The buffer can be used as the *destination* of a GPU-side copy operation.
     */&lt;/span&gt;
    &lt;span class=&quot;kd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;static&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;_CopyDst&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;WGPUBufferUsage&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;get&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;This means that, if you’re passing a value of type &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;WPUBufferUsage&lt;/code&gt;, you can use the shorthand “leading dot” syntax. For example:&lt;/p&gt;

&lt;div class=&quot;language-swift highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;kd&quot;&gt;func&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;setBufferUsage&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;_&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;usage&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;WGPUBufferUsage&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;...&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;

&lt;span class=&quot;nf&quot;&gt;setBufferUsage&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;_MapRead&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Swift has dropped the common &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;WPUBufferUsage&lt;/code&gt; prefix from the constants when it made them into members. However, the resulting names aren’t great. We can rename them by providing a &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;SwiftName&lt;/code&gt; in the API notes file within the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Globals&lt;/code&gt; section:&lt;/p&gt;

&lt;div class=&quot;language-yaml highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;na&quot;&gt;Globals&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
&lt;span class=&quot;pi&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;Name&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;WGPUBufferUsage_MapRead&lt;/span&gt;
  &lt;span class=&quot;na&quot;&gt;SwiftName&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;WGPUBufferUsage.mapRead&lt;/span&gt;
&lt;span class=&quot;pi&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;Name&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;WGPUBufferUsage_MapWrite&lt;/span&gt;
  &lt;span class=&quot;na&quot;&gt;SwiftName&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;WGPUBufferUsage.mapWrite&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;We can go one step further by making the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;WGPUBufferUsage&lt;/code&gt; type conform to Swift’s &lt;a href=&quot;https://developer.apple.com/documentation/swift/optionset&quot;&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;OptionSet&lt;/code&gt;&lt;/a&gt; protocol. If we revise the API notes like this:&lt;/p&gt;

&lt;div class=&quot;language-yaml highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;na&quot;&gt;Typedefs&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
&lt;span class=&quot;pi&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;Name&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;WGPUBufferUsage&lt;/span&gt;
  &lt;span class=&quot;na&quot;&gt;SwiftWrapper&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;struct&lt;/span&gt;
  &lt;span class=&quot;na&quot;&gt;SwiftConformsTo&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;Swift.OptionSet&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Now, we get the nice option-set syntax we expect in Swift:&lt;/p&gt;

&lt;div class=&quot;language-swift highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;k&quot;&gt;let&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;usageFlags&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;WGPUBufferUsage&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;mapRead&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;mapWrite&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h2 id=&quot;nullability&quot; class=&quot;header-with-anchor&quot;&gt;Nullability &lt;a title=&quot;Permalink for Nullability section&quot; href=&quot;#nullability&quot;&gt;
            &lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt; &lt;svg width=&quot;18px&quot; height=&quot;18px&quot; viewBox=&quot;0 0 14 14&quot; role=&quot;img&quot; focusable=&quot;false&quot; aria-hidden=&quot;true&quot; xmlns=&quot;http://www.w3.org/2000/svg&quot;&gt;&lt;path d=&quot;m 11.58824,9.823529 q 0,-0.294117 -0.20589,-0.499999 L 9.85294,7.794118 q -0.20588,-0.205883 -0.5,-0.205883 -0.30882,0 -0.52941,0.235295 0.0221,0.02206 0.13971,0.136029 0.11764,0.113971 0.15808,0.158088 0.0404,0.04412 0.1103,0.139706 0.0698,0.09559 0.0956,0.1875 0.0257,0.09191 0.0257,0.202206 0,0.294117 -0.20588,0.5 -0.20588,0.205882 -0.5,0.205882 -0.1103,0 -0.20221,-0.02573 Q 8.35293,9.301471 8.25733,9.231621 8.16173,9.161771 8.11763,9.121327 8.07353,9.080887 7.95954,8.963238 7.84557,8.845591 7.82351,8.823533 7.58086,9.051474 7.58086,9.360297 q 0,0.294118 0.20588,0.5 l 1.51471,1.522059 q 0.19853,0.19853 0.5,0.19853 0.29412,0 0.5,-0.191177 l 1.08088,-1.073529 q 0.20589,-0.205883 0.20589,-0.492648 z M 6.41912,4.639706 q 0,-0.294118 -0.20588,-0.5 L 4.69853,2.617647 q -0.20588,-0.205882 -0.5,-0.205882 -0.28677,0 -0.5,0.198529 L 2.61765,3.683823 q -0.20589,0.205883 -0.20589,0.492648 0,0.294117 0.20589,0.499999 l 1.52941,1.529412 q 0.19853,0.19853 0.5,0.19853 0.30882,0 0.52941,-0.227942 Q 5.15437,6.15441 5.03676,6.040441 4.91912,5.92647 4.87868,5.882353 4.83828,5.838233 4.76838,5.742647 q -0.0698,-0.09559 -0.0956,-0.1875 -0.0257,-0.09191 -0.0257,-0.202206 0,-0.294117 0.20588,-0.5 0.20588,-0.205882 0.5,-0.205882 0.1103,0 0.20221,0.02573 0.0919,0.02573 0.1875,0.09559 0.0956,0.06985 0.1397,0.110294 0.0441,0.04044 0.15809,0.158089 Q 6.15443,5.154409 6.17649,5.176467 6.41914,4.948526 6.41914,4.639703 z M 13,9.823529 q 0,0.882353 -0.625,1.492647 l -1.08088,1.07353 Q 10.68382,13 9.80147,13 q -0.88971,0 -1.5,-0.625 L 6.78676,10.852941 Q 6.17647,10.242647 6.17647,9.360294 q 0,-0.904412 0.64706,-1.536764 L 6.17647,7.176471 Q 5.54412,7.82353 4.64706,7.82353 q -0.88235,0 -1.5,-0.617648 L 1.617647,5.676471 Q 1,5.058824 1,4.176471 1,3.294118 1.625,2.683824 L 2.70588,1.610294 Q 3.31618,1 4.19853,1 q 0.88971,0 1.5,0.625 l 1.51471,1.522059 q 0.61029,0.610294 0.61029,1.492647 0,0.904412 -0.64706,1.536764 L 7.82353,6.823529 Q 8.45588,6.17647 9.35294,6.17647 q 0.88235,0 1.5,0.617648 l 1.52941,1.529411 Q 13,8.941176 13,9.823529 z&quot;/&gt;&lt;/svg&gt;
          &lt;/a&gt;&lt;/h2&gt;

&lt;p&gt;Throughout &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;webgpu.h&lt;/code&gt;, the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;WGPU_NULLABLE&lt;/code&gt; macro is used to indicate pointers that can be NULL. The implication is that any pointer that is not marked with &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;WGPU_NULLABLE&lt;/code&gt; cannot be NULL. For example, here is the definition of &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;wgpuCreateInstance&lt;/code&gt; we used above:&lt;/p&gt;

&lt;div class=&quot;language-c highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;n&quot;&gt;WGPU_EXPORT&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;WGPUInstance&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;wgpuCreateInstance&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;WGPU_NULLABLE&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;WGPUInstanceDescriptor&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;*&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;descriptor&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;WGPU_FUNCTION_ATTRIBUTE&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;The &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;WGPU_NULLABLE&lt;/code&gt; indicates that it’s acceptable to pass a NULL pointer in as the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;descriptor&lt;/code&gt; parameter. Clang already has &lt;a href=&quot;https://clang.llvm.org/docs/AttributeReference.html#nullability-attributes&quot;&gt;nullability specifiers&lt;/a&gt; to express this information. We could alter the declaration in the header to express that this parameter is nullable but the result type is never NULL, like this:&lt;/p&gt;

&lt;div class=&quot;language-swift highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;kt&quot;&gt;WGPU_EXPORT&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;WGPUInstance&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;_Nonnull&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;wgpuCreateInstance&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;WGPU_NULLABLE&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;WGPUInstanceDescriptor&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;*&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;_Nullable&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;descriptor&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;WGPU_FUNCTION_ATTRIBUTE&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;This eliminates the implicitly-unwrapped optionals (&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;!&lt;/code&gt;) from the signature of the initializer, so we end up with one that explicitly accepts a &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;nil&lt;/code&gt; descriptor argument and always returns a new instance (never &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;nil&lt;/code&gt;):&lt;/p&gt;

&lt;div class=&quot;language-swift highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;kd&quot;&gt;extension&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;WGPUInstanceImpl&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;cm&quot;&gt;/**
     * Create a WGPUInstance
     *
     * @returns
     * This value is @ref ReturnedWithOwnership.
     */&lt;/span&gt;
    &lt;span class=&quot;kd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;cm&quot;&gt;/*not inherited*/&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;init&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;descriptor&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;UnsafePointer&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;WGPUInstanceDescriptor&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;?)&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Now, I did cheat by hacking the header. Instead, we can express this with API notes on the parameters and result type by extending the entry we already have for &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;wgpuCreateInstance&lt;/code&gt; like this:&lt;/p&gt;

&lt;div class=&quot;language-yaml highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;pi&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;Name&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;wgpuCreateInstance&lt;/span&gt;
  &lt;span class=&quot;na&quot;&gt;SwiftReturnOwnership&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;retained&lt;/span&gt;
  &lt;span class=&quot;na&quot;&gt;SwiftName&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;WGPUInstanceImpl.init(descriptor:)&lt;/span&gt;
  &lt;span class=&quot;na&quot;&gt;Parameters&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
  &lt;span class=&quot;pi&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;Position&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;0&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;Nullability&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;O&lt;/span&gt;
  &lt;span class=&quot;na&quot;&gt;ResultType&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;WGPUInstance&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s&quot;&gt;_Nonnull&quot;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;To specific nullability of pointer parameters, one can identify them by position (where 0 is the first parameter to the function) and then specify whether the parameter should come into Swift as optional (&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;O&lt;/code&gt;, corresponds to &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;_Nullable&lt;/code&gt;), non-optional (&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;N&lt;/code&gt;, corresponds to &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;_Nonnull&lt;/code&gt;) or by left unspecified as an implicitly-unwrapped optional (&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;U&lt;/code&gt;, corresponds to &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;_Null_unspecified&lt;/code&gt;). For the result type, it’s a little different: we specified the result type along with the nullability specifier, i.e., &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;WGPUInstance _Nonnull&lt;/code&gt;. The end result of these annotations is the same as the modified header, so we can layer nullability information on top of the header.&lt;/p&gt;

&lt;h2 id=&quot;scripting-the-creation-of-webgpuapinotes&quot; class=&quot;header-with-anchor&quot;&gt;Scripting the creation of WebGPU.apinotes &lt;a title=&quot;Permalink for Scripting the creation of WebGPU.apinotes section&quot; href=&quot;#scripting-the-creation-of-webgpuapinotes&quot;&gt;
            &lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt; &lt;svg width=&quot;18px&quot; height=&quot;18px&quot; viewBox=&quot;0 0 14 14&quot; role=&quot;img&quot; focusable=&quot;false&quot; aria-hidden=&quot;true&quot; xmlns=&quot;http://www.w3.org/2000/svg&quot;&gt;&lt;path d=&quot;m 11.58824,9.823529 q 0,-0.294117 -0.20589,-0.499999 L 9.85294,7.794118 q -0.20588,-0.205883 -0.5,-0.205883 -0.30882,0 -0.52941,0.235295 0.0221,0.02206 0.13971,0.136029 0.11764,0.113971 0.15808,0.158088 0.0404,0.04412 0.1103,0.139706 0.0698,0.09559 0.0956,0.1875 0.0257,0.09191 0.0257,0.202206 0,0.294117 -0.20588,0.5 -0.20588,0.205882 -0.5,0.205882 -0.1103,0 -0.20221,-0.02573 Q 8.35293,9.301471 8.25733,9.231621 8.16173,9.161771 8.11763,9.121327 8.07353,9.080887 7.95954,8.963238 7.84557,8.845591 7.82351,8.823533 7.58086,9.051474 7.58086,9.360297 q 0,0.294118 0.20588,0.5 l 1.51471,1.522059 q 0.19853,0.19853 0.5,0.19853 0.29412,0 0.5,-0.191177 l 1.08088,-1.073529 q 0.20589,-0.205883 0.20589,-0.492648 z M 6.41912,4.639706 q 0,-0.294118 -0.20588,-0.5 L 4.69853,2.617647 q -0.20588,-0.205882 -0.5,-0.205882 -0.28677,0 -0.5,0.198529 L 2.61765,3.683823 q -0.20589,0.205883 -0.20589,0.492648 0,0.294117 0.20589,0.499999 l 1.52941,1.529412 q 0.19853,0.19853 0.5,0.19853 0.30882,0 0.52941,-0.227942 Q 5.15437,6.15441 5.03676,6.040441 4.91912,5.92647 4.87868,5.882353 4.83828,5.838233 4.76838,5.742647 q -0.0698,-0.09559 -0.0956,-0.1875 -0.0257,-0.09191 -0.0257,-0.202206 0,-0.294117 0.20588,-0.5 0.20588,-0.205882 0.5,-0.205882 0.1103,0 0.20221,0.02573 0.0919,0.02573 0.1875,0.09559 0.0956,0.06985 0.1397,0.110294 0.0441,0.04044 0.15809,0.158089 Q 6.15443,5.154409 6.17649,5.176467 6.41914,4.948526 6.41914,4.639703 z M 13,9.823529 q 0,0.882353 -0.625,1.492647 l -1.08088,1.07353 Q 10.68382,13 9.80147,13 q -0.88971,0 -1.5,-0.625 L 6.78676,10.852941 Q 6.17647,10.242647 6.17647,9.360294 q 0,-0.904412 0.64706,-1.536764 L 6.17647,7.176471 Q 5.54412,7.82353 4.64706,7.82353 q -0.88235,0 -1.5,-0.617648 L 1.617647,5.676471 Q 1,5.058824 1,4.176471 1,3.294118 1.625,2.683824 L 2.70588,1.610294 Q 3.31618,1 4.19853,1 q 0.88971,0 1.5,0.625 l 1.51471,1.522059 q 0.61029,0.610294 0.61029,1.492647 0,0.904412 -0.64706,1.536764 L 7.82353,6.823529 Q 8.45588,6.17647 9.35294,6.17647 q 0.88235,0 1.5,0.617648 l 1.52941,1.529411 Q 13,8.941176 13,9.823529 z&quot;/&gt;&lt;/svg&gt;
          &lt;/a&gt;&lt;/h2&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;webgpu.h&lt;/code&gt; is about 6,400 lines long, and is regenerated from a database of the API as needed. Each of the WebGPU implementations seems to augment or tweak the header a bit. So, rather than grind through and manually do annotations, I wrote a little Swift script to “parse” &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;webgpu.h&lt;/code&gt;, identify its patterns, and generate &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;WebGPU.apinotes&lt;/code&gt; for most of what is discussed in this post. The entirety of the script is &lt;a href=&quot;/assets/blog/improving-usability-of-c-libraries-in-swift/webgpu_apinotes.swift&quot;&gt;here&lt;/a&gt;. It reads &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;webgpu.h&lt;/code&gt; from standard input and prints &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;WebGPU.apinotes&lt;/code&gt; to standard output.&lt;/p&gt;

&lt;p&gt;Because &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;webgpu.h&lt;/code&gt; is generated, it has a very regular structure that we can pick up on via regular expressions. For example:&lt;/p&gt;

&lt;div class=&quot;language-swift highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;c1&quot;&gt;// Enum definitions, marked by WGPU_ENUM_ATTRIBUTE.&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;let&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;enumMatcher&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;sr&quot;&gt;/} (?&amp;lt;name&amp;gt;\w+?) WGPU_ENUM_ATTRIBUTE/&lt;/span&gt;

&lt;span class=&quot;c1&quot;&gt;// Object definitions, marked by WGPU_OBJECT_ATTRIBUTE.&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;let&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;objectMatcher&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;sr&quot;&gt;/typedef struct (?&amp;lt;implName&amp;gt;\w+?)\* (?&amp;lt;name&amp;gt;\w+?) WGPU_OBJECT_ATTRIBUTE;/&lt;/span&gt;

&lt;span class=&quot;c1&quot;&gt;// Function declarations, marked by WGPU_FUNCTION_ATTRIBUTE&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;let&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;functionMatcher&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;sr&quot;&gt;/WGPU_EXPORT (?&amp;lt;nullableResult&amp;gt;WGPU_NULLABLE ?)?(?&amp;lt;resultType&amp;gt;\w+?) (?&amp;lt;name&amp;gt;\w+?)\((?&amp;lt;parameters&amp;gt;.*\)?) WGPU_FUNCTION_ATTRIBUTE;/&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;let&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;parameterMatcher&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;sr&quot;&gt;/(?&amp;lt;type&amp;gt;[^),]+?) (?&amp;lt;name&amp;gt;\w+?)[),]/&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;That’s enough to identify all of the enum types (so we can emit the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;EnumExtensibility: closed&lt;/code&gt; API notes), object types (to turn them into shared references), and functions (which get nicer names and such). The script is just a big &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;readLine&lt;/code&gt; loop that applies the regexes to capture all of the various types and functions, then does some quick classification before printing out the API notes. The resulting API notes are &lt;a href=&quot;/assets/blog/improving-usability-of-c-libraries-in-swift/WebGPU.apinotes&quot;&gt;in WebGPU.apinotes&lt;/a&gt;, and the generated Swift interface after these API notes are applied is &lt;a href=&quot;/assets/blog/improving-usability-of-c-libraries-in-swift/WebGPU.swiftinterface&quot;&gt;here&lt;/a&gt;. You can run it with, e.g.,&lt;/p&gt;

&lt;div class=&quot;language-shell highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;swift &lt;span class=&quot;nt&quot;&gt;-enable-bare-slash-regex&lt;/span&gt; webgpu_apinotes.swift &amp;lt; webgpu.h
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;This script full of regular expressions is, admittedly, a bit of a hack. A better approach for an arbitrary C header would be to use &lt;a href=&quot;https://clang.llvm.org/docs/LibClang.html&quot;&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;libclang&lt;/code&gt;&lt;/a&gt; to properly parse the headers. For WebGPU specifically, the webgpu-headers project contains a database from which the header is generated, and one could also generate API notes directly from that database. Regardless of how you get there, many C libraries have well-structured headers with conventions that can be leveraged to create safer, more ergonomic projections in Swift.&lt;/p&gt;

&lt;h2 id=&quot;swiftifying-your-favorite-c-library&quot; class=&quot;header-with-anchor&quot;&gt;Swiftifying your favorite C library &lt;a title=&quot;Permalink for Swiftifying your favorite C library section&quot; href=&quot;#swiftifying-your-favorite-c-library&quot;&gt;
            &lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt; &lt;svg width=&quot;18px&quot; height=&quot;18px&quot; viewBox=&quot;0 0 14 14&quot; role=&quot;img&quot; focusable=&quot;false&quot; aria-hidden=&quot;true&quot; xmlns=&quot;http://www.w3.org/2000/svg&quot;&gt;&lt;path d=&quot;m 11.58824,9.823529 q 0,-0.294117 -0.20589,-0.499999 L 9.85294,7.794118 q -0.20588,-0.205883 -0.5,-0.205883 -0.30882,0 -0.52941,0.235295 0.0221,0.02206 0.13971,0.136029 0.11764,0.113971 0.15808,0.158088 0.0404,0.04412 0.1103,0.139706 0.0698,0.09559 0.0956,0.1875 0.0257,0.09191 0.0257,0.202206 0,0.294117 -0.20588,0.5 -0.20588,0.205882 -0.5,0.205882 -0.1103,0 -0.20221,-0.02573 Q 8.35293,9.301471 8.25733,9.231621 8.16173,9.161771 8.11763,9.121327 8.07353,9.080887 7.95954,8.963238 7.84557,8.845591 7.82351,8.823533 7.58086,9.051474 7.58086,9.360297 q 0,0.294118 0.20588,0.5 l 1.51471,1.522059 q 0.19853,0.19853 0.5,0.19853 0.29412,0 0.5,-0.191177 l 1.08088,-1.073529 q 0.20589,-0.205883 0.20589,-0.492648 z M 6.41912,4.639706 q 0,-0.294118 -0.20588,-0.5 L 4.69853,2.617647 q -0.20588,-0.205882 -0.5,-0.205882 -0.28677,0 -0.5,0.198529 L 2.61765,3.683823 q -0.20589,0.205883 -0.20589,0.492648 0,0.294117 0.20589,0.499999 l 1.52941,1.529412 q 0.19853,0.19853 0.5,0.19853 0.30882,0 0.52941,-0.227942 Q 5.15437,6.15441 5.03676,6.040441 4.91912,5.92647 4.87868,5.882353 4.83828,5.838233 4.76838,5.742647 q -0.0698,-0.09559 -0.0956,-0.1875 -0.0257,-0.09191 -0.0257,-0.202206 0,-0.294117 0.20588,-0.5 0.20588,-0.205882 0.5,-0.205882 0.1103,0 0.20221,0.02573 0.0919,0.02573 0.1875,0.09559 0.0956,0.06985 0.1397,0.110294 0.0441,0.04044 0.15809,0.158089 Q 6.15443,5.154409 6.17649,5.176467 6.41914,4.948526 6.41914,4.639703 z M 13,9.823529 q 0,0.882353 -0.625,1.492647 l -1.08088,1.07353 Q 10.68382,13 9.80147,13 q -0.88971,0 -1.5,-0.625 L 6.78676,10.852941 Q 6.17647,10.242647 6.17647,9.360294 q 0,-0.904412 0.64706,-1.536764 L 6.17647,7.176471 Q 5.54412,7.82353 4.64706,7.82353 q -0.88235,0 -1.5,-0.617648 L 1.617647,5.676471 Q 1,5.058824 1,4.176471 1,3.294118 1.625,2.683824 L 2.70588,1.610294 Q 3.31618,1 4.19853,1 q 0.88971,0 1.5,0.625 l 1.51471,1.522059 q 0.61029,0.610294 0.61029,1.492647 0,0.904412 -0.64706,1.536764 L 7.82353,6.823529 Q 8.45588,6.17647 9.35294,6.17647 q 0.88235,0 1.5,0.617648 l 1.52941,1.529411 Q 13,8.941176 13,9.823529 z&quot;/&gt;&lt;/svg&gt;
          &lt;/a&gt;&lt;/h2&gt;

&lt;p&gt;The techniques described in this post can be applied to just about any C library. To do so, I recommend setting up a small package like the one described here for WebGPU, so you can iterate quickly on example code to get a feel for how the Swift projection of the C API will work. The annotations might not get you all the way to the best Swift API, but they are a lightweight way to get most of the way there. Feel free to also extend the C types to convenience APIs that make sense in Swift, like I did above to make &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;WGPUBool&lt;/code&gt; conform to &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;ExpressibleByBooleanLiteral&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;A little bit of annotation work on your favorite C library can make for a safer, more ergonomic, more Swifty experience of working with that library.&lt;/p&gt;

&lt;h2 id=&quot;postscript-thoughts-for-improving-the-generated-webgpuh&quot; class=&quot;header-with-anchor&quot;&gt;Postscript: Thoughts for improving the generated webgpu.h &lt;a title=&quot;Permalink for Postscript: Thoughts for improving the generated webgpu.h section&quot; href=&quot;#postscript-thoughts-for-improving-the-generated-webgpuh&quot;&gt;
            &lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt; &lt;svg width=&quot;18px&quot; height=&quot;18px&quot; viewBox=&quot;0 0 14 14&quot; role=&quot;img&quot; focusable=&quot;false&quot; aria-hidden=&quot;true&quot; xmlns=&quot;http://www.w3.org/2000/svg&quot;&gt;&lt;path d=&quot;m 11.58824,9.823529 q 0,-0.294117 -0.20589,-0.499999 L 9.85294,7.794118 q -0.20588,-0.205883 -0.5,-0.205883 -0.30882,0 -0.52941,0.235295 0.0221,0.02206 0.13971,0.136029 0.11764,0.113971 0.15808,0.158088 0.0404,0.04412 0.1103,0.139706 0.0698,0.09559 0.0956,0.1875 0.0257,0.09191 0.0257,0.202206 0,0.294117 -0.20588,0.5 -0.20588,0.205882 -0.5,0.205882 -0.1103,0 -0.20221,-0.02573 Q 8.35293,9.301471 8.25733,9.231621 8.16173,9.161771 8.11763,9.121327 8.07353,9.080887 7.95954,8.963238 7.84557,8.845591 7.82351,8.823533 7.58086,9.051474 7.58086,9.360297 q 0,0.294118 0.20588,0.5 l 1.51471,1.522059 q 0.19853,0.19853 0.5,0.19853 0.29412,0 0.5,-0.191177 l 1.08088,-1.073529 q 0.20589,-0.205883 0.20589,-0.492648 z M 6.41912,4.639706 q 0,-0.294118 -0.20588,-0.5 L 4.69853,2.617647 q -0.20588,-0.205882 -0.5,-0.205882 -0.28677,0 -0.5,0.198529 L 2.61765,3.683823 q -0.20589,0.205883 -0.20589,0.492648 0,0.294117 0.20589,0.499999 l 1.52941,1.529412 q 0.19853,0.19853 0.5,0.19853 0.30882,0 0.52941,-0.227942 Q 5.15437,6.15441 5.03676,6.040441 4.91912,5.92647 4.87868,5.882353 4.83828,5.838233 4.76838,5.742647 q -0.0698,-0.09559 -0.0956,-0.1875 -0.0257,-0.09191 -0.0257,-0.202206 0,-0.294117 0.20588,-0.5 0.20588,-0.205882 0.5,-0.205882 0.1103,0 0.20221,0.02573 0.0919,0.02573 0.1875,0.09559 0.0956,0.06985 0.1397,0.110294 0.0441,0.04044 0.15809,0.158089 Q 6.15443,5.154409 6.17649,5.176467 6.41914,4.948526 6.41914,4.639703 z M 13,9.823529 q 0,0.882353 -0.625,1.492647 l -1.08088,1.07353 Q 10.68382,13 9.80147,13 q -0.88971,0 -1.5,-0.625 L 6.78676,10.852941 Q 6.17647,10.242647 6.17647,9.360294 q 0,-0.904412 0.64706,-1.536764 L 6.17647,7.176471 Q 5.54412,7.82353 4.64706,7.82353 q -0.88235,0 -1.5,-0.617648 L 1.617647,5.676471 Q 1,5.058824 1,4.176471 1,3.294118 1.625,2.683824 L 2.70588,1.610294 Q 3.31618,1 4.19853,1 q 0.88971,0 1.5,0.625 l 1.51471,1.522059 q 0.61029,0.610294 0.61029,1.492647 0,0.904412 -0.64706,1.536764 L 7.82353,6.823529 Q 8.45588,6.17647 9.35294,6.17647 q 0.88235,0 1.5,0.617648 l 1.52941,1.529411 Q 13,8.941176 13,9.823529 z&quot;/&gt;&lt;/svg&gt;
          &lt;/a&gt;&lt;/h2&gt;

&lt;p&gt;The regular structure of &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;webgpu.h&lt;/code&gt; helped considerably when trying to expose the API nicely in Swift. That said, there are a few ways in which &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;webgpu.h&lt;/code&gt; could be improved to require less annotation for this purpose:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;
    &lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;WGPU_ENUM_ATTRIBUTE&lt;/code&gt; would be slightly nicer if placed on the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;enum&lt;/code&gt; itself, rather than on the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;typedef&lt;/code&gt;. If it were there, we could use&lt;/p&gt;

    &lt;div class=&quot;language-c highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;cp&quot;&gt;#define WGPU_ENUM_ATTRIBUTE __attribute__((enum_extensibility(closed)))
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;    &lt;/div&gt;

    &lt;p&gt;and not have to generate any API notes to bring these types in as proper enums in Swift.&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;WGPU_OBJECT_ATTRIBUTE&lt;/code&gt; could provide the names of the retain and release operations and be placed on the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;struct&lt;/code&gt; itself. If it were there, we could use&lt;/p&gt;

    &lt;div class=&quot;language-c highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;cp&quot;&gt;#define WGPU_OBJECT_ATTRIBUTE(RetainFn,ReleaseFn) SWIFT_SHARED_REFERENCE(RetainFn,ReleaseFn)
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;    &lt;/div&gt;

    &lt;p&gt;and not have to generate any API notes to bring these types in as classes in Swift.&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;WGPU_NULLABLE&lt;/code&gt; could be placed on the pointer itself (i.e., after the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;*&lt;/code&gt;) rather than at the beginning of the type, to match the position of &lt;a href=&quot;https://clang.llvm.org/docs/AttributeReference.html#nullability-attributes&quot;&gt;Clang’s nullability attributes&lt;/a&gt;. If it were placed there, then&lt;/p&gt;

    &lt;div class=&quot;language-c highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;cp&quot;&gt;#define WGPU_NULLABLE _Nullable
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;    &lt;/div&gt;

    &lt;p&gt;would work with Clangs’ longstanding nullable-types support. Swift would then import such pointers as optional types (with &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;?&lt;/code&gt;). Moreover, if some macros &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;WGPU_ASSUME_NONNULL_BEGIN&lt;/code&gt; and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;WGPU_ASSUME_NONNULL_END&lt;/code&gt; were placed at the beginning and end of the header, they could be mapped to Clang’s pragmas to assume that any pointer not marked “nullable” is always non-null:&lt;/p&gt;
    &lt;div class=&quot;language-c highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;cp&quot;&gt;#define WGPU_ASSUME_NONNULL_BEGIN #pragma clang assume_nonnull begin
#define WGPU_ASSUME_NONNULL_END #pragma clang assume_nonnull end
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;    &lt;/div&gt;

    &lt;p&gt;This would eliminate all of the implicitly unwrapped optionals (marked &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;!&lt;/code&gt; in the Swift interface), making it easier to use safely.&lt;/p&gt;
  &lt;/li&gt;
&lt;/ul&gt;
</content>
  </entry>
  
</feed>
