<?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 Swift Discovery</title>
    <link>http://onmyway133.com/tags/concurrency/</link>
    <description>Recent content in Concurrency on Swift Discovery</description>
    <generator>Hugo</generator>
    <language>en-us</language>
    <lastBuildDate>Thu, 07 May 2026 07:57:27 +0000</lastBuildDate>
    <atom:link href="http://onmyway133.com/tags/concurrency/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>How to use SwiftData</title>
      <link>http://onmyway133.com/posts/how-to-use-swiftdata/</link>
      <pubDate>Thu, 07 May 2026 07:56:26 +0000</pubDate>
      <guid>http://onmyway133.com/posts/how-to-use-swiftdata/</guid>
      <description>&lt;p&gt;&lt;strong&gt;Issue &lt;a href=&#34;https://github.com/onmyway133/blog/issues/1040&#34;&gt;#1040&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;SwiftData is Apple&amp;rsquo;s modern persistence framework, introduced in iOS 17. It builds on top of Core Data but exposes a Swift-native API using macros and property wrappers. For most apps targeting iOS 17 or later, it replaces Core Data entirely without needing to touch an &lt;code&gt;xcdatamodeld&lt;/code&gt; file or write fetch requests by hand.&lt;/p&gt;&#xA;&lt;h2 id=&#34;defining-a-model&#34;&gt;Defining a model&lt;/h2&gt;&#xA;&lt;p&gt;The entry point for any SwiftData app is the &lt;code&gt;@Model&lt;/code&gt; macro. Apply it to a class and SwiftData automatically makes it persistable and observable.&lt;/p&gt;</description>
    </item>
    <item>
      <title>How to use isolated and nonisolated in Swift 6 concurrency</title>
      <link>http://onmyway133.com/posts/how-to-use-isolated-and-nonisolated-in-swift-6-concurrency/</link>
      <pubDate>Thu, 07 May 2026 07:34:33 +0000</pubDate>
      <guid>http://onmyway133.com/posts/how-to-use-isolated-and-nonisolated-in-swift-6-concurrency/</guid>
      <description>&lt;p&gt;&lt;strong&gt;Issue &lt;a href=&#34;https://github.com/onmyway133/blog/issues/1039&#34;&gt;#1039&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;Actor isolation in Swift 6 is not binary. A type can be mostly isolated while selectively exposing some members to callers from any context. A function can accept any actor and run directly on its executor without being bound to it permanently. Two keywords control this: &lt;code&gt;nonisolated&lt;/code&gt; opts a member out of its enclosing isolation, and &lt;code&gt;isolated&lt;/code&gt; makes a function parameter a live entry point into an actor&amp;rsquo;s context. Understanding both turns isolation from a wall into a precision tool.&lt;/p&gt;</description>
    </item>
    <item>
      <title>How to use Swift 6 concurrency</title>
      <link>http://onmyway133.com/posts/how-to-use-swift-6-concurrency/</link>
      <pubDate>Thu, 07 May 2026 07:09:21 +0000</pubDate>
      <guid>http://onmyway133.com/posts/how-to-use-swift-6-concurrency/</guid>
      <description>&lt;p&gt;&lt;strong&gt;Issue &lt;a href=&#34;https://github.com/onmyway133/blog/issues/1038&#34;&gt;#1038&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;Swift 6 concurrency replaces Grand Central Dispatch queues, locks, and completion handlers with a structured model built around &lt;code&gt;async/await&lt;/code&gt;, actors, and task groups. The compiler enforces isolation rules at build time, and the runtime catches violations that slip through. This article walks through the core tools and the patterns that make them work correctly.&lt;/p&gt;&#xA;&lt;h2 id=&#34;asyncawait&#34;&gt;async/await&lt;/h2&gt;&#xA;&lt;p&gt;Marking a function &lt;code&gt;async&lt;/code&gt; means it can suspend without blocking the thread it runs on. When it suspends, the thread is freed to do other work. When the awaited value is ready, Swift resumes the function, possibly on a different thread.&lt;/p&gt;</description>
    </item>
    <item>
      <title>How to avoid Swift 6 concurrency crashes</title>
      <link>http://onmyway133.com/posts/how-to-avoid-swift-6-concurrency-crashes/</link>
      <pubDate>Thu, 07 May 2026 07:01:00 +0000</pubDate>
      <guid>http://onmyway133.com/posts/how-to-avoid-swift-6-concurrency-crashes/</guid>
      <description>&lt;p&gt;&lt;strong&gt;Issue &lt;a href=&#34;https://github.com/onmyway133/blog/issues/1037&#34;&gt;#1037&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;Enabling Swift 6 strict concurrency checking (&lt;code&gt;SWIFT_STRICT_CONCURRENCY = complete&lt;/code&gt;) catches data races at compile time, but it does not protect you fully at runtime. The compiler also injects dynamic isolation assertions at actor and GCD boundaries. These fire in production, not just in your test suite, often at callsites that produced no compiler warning at all.&lt;/p&gt;&#xA;&lt;p&gt;The two crash symbols you will see in crash reports are&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;code&gt;_dispatch_assert_queue_fail&lt;/code&gt;, which fires when code expected a specific dispatch queue but ran on a different one&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;_swift_task_checkIsolatedSwift&lt;/code&gt;, which fires when code expected actor isolation (for example, &lt;code&gt;@MainActor&lt;/code&gt;) but ran outside it.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;Both originate from the same root cause: a piece of code inherited actor isolation from its definition context and was then called from a different thread.&lt;/p&gt;</description>
    </item>
  </channel>
</rss>
