<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>Concurrency on Robert Harrison</title>
    <link>https://robertharrison.ca/tags/concurrency/</link>
    <description>Recent content in Concurrency on Robert Harrison</description>
    <generator>Hugo</generator>
    <language>en-us</language>
    <lastBuildDate>Sat, 01 Mar 2025 14:35:00 -0700</lastBuildDate>
    <atom:link href="https://robertharrison.ca/tags/concurrency/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>Swift Singleton with @unchecked Sendable</title>
      <link>https://robertharrison.ca/blog/swift-singleton-with-unchecked-sendable/</link>
      <pubDate>Sat, 01 Mar 2025 14:35:00 -0700</pubDate>
      <guid>https://robertharrison.ca/blog/swift-singleton-with-unchecked-sendable/</guid>
      <description>&lt;p&gt;A &lt;strong&gt;singleton&lt;/strong&gt; is a design pattern that ensures there is only one instance of a class. While convenient, there are drawbacks to using singletons, which are well documented elsewhere. Swift 6 provides some approaches to replacing Singletons, such as Actor. Sometimes, you run into a situation, such as re-using legacy code, where using a Singleton is preferable over refactoring to modern Swift techniques.&lt;/p&gt;&#xA;&lt;p&gt;Pre-Swift 6, a singleton could be written like so:&lt;/p&gt;</description>
    </item>
  </channel>
</rss>
