<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/">
  <channel>
    <title>Mobile Dev Diary</title>
    <link>https://www.mobiledevdiary.com/</link>
    <description>Recent content on Mobile Dev Diary</description>
    <image>
      <title>Mobile Dev Diary</title>
      <url>https://www.mobiledevdiary.com/mobile-dev-diary.jpg</url>
      <link>https://www.mobiledevdiary.com/mobile-dev-diary.jpg</link>
    </image>
    <generator>Hugo -- 0.141.0</generator>
    <language>en</language>
    <lastBuildDate>Tue, 17 Jun 2025 00:00:00 +0000</lastBuildDate>
    <atom:link href="https://www.mobiledevdiary.com/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>Say hello to the Apple&#39;s new Liquid Glass design</title>
      <link>https://www.mobiledevdiary.com/posts/wwdc-2025-liquid-glass-design/</link>
      <pubDate>Tue, 17 Jun 2025 00:00:00 +0000</pubDate>
      <guid>https://www.mobiledevdiary.com/posts/wwdc-2025-liquid-glass-design/</guid>
      <description>&lt;p&gt;At this year&amp;rsquo;s WWDC, Apple introduced a major visual update the &amp;ldquo;Liquid Glass&amp;rdquo; design - a dynamic new material arriving with iOS 26. Yes, you read that right: all the rumours were true, and we&amp;rsquo;re jumping straight from iOS 18 to iOS 26.&lt;/p&gt;
&lt;p&gt;How do I feel about the new design?
Honestly, I like it. I did a small side by side comparison using Simulator between iOS 18 and iOS 26. The new look speaks to me more. It feels more modern&amp;hellip;&lt;/p&gt;</description>
    </item>
    <item>
      <title>WWDC25 - New possibilities have arrived!</title>
      <link>https://www.mobiledevdiary.com/posts/wwdc-2025-new-possibilities-have-arrived/</link>
      <pubDate>Mon, 16 Jun 2025 00:00:00 +0000</pubDate>
      <guid>https://www.mobiledevdiary.com/posts/wwdc-2025-new-possibilities-have-arrived/</guid>
      <description>&lt;p&gt;New possibilities have arrived! 🛬&lt;/p&gt;
&lt;p&gt;This year, Apple released 14 new beta frameworks, bringing powerful tools for product builders to craft outstanding features.&lt;/p&gt;
&lt;p&gt;As the platform grows, so does its complexity. Don&amp;rsquo;t worry! You don&amp;rsquo;t have to master all of them at once (most you may never even use). Instead, focus on understanding each framework&amp;rsquo;s core purpose. This will broaden your awareness of available tooling and help you later assess which framework you need to solve a given problem - you can dive deeper when the need comes.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Will enter foreground or won&#39;t?</title>
      <link>https://www.mobiledevdiary.com/posts/will-it-enter-foreground-or-wont/</link>
      <pubDate>Tue, 03 Jun 2025 00:00:00 +0000</pubDate>
      <guid>https://www.mobiledevdiary.com/posts/will-it-enter-foreground-or-wont/</guid>
      <description>&lt;h2 id=&#34;intro&#34;&gt;Intro&lt;/h2&gt;
&lt;p&gt;All across iOS dev blogs and posts you read about AppDelegate being deprecated in the next major iOS release.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;AppDelegate has been a go-to for app lifecycle handling since iOS 2.&lt;/li&gt;
&lt;li&gt;From iOS 13, SceneDelegate lives alongside AppDelegate handling per-scene lifecycle.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Do the methods &lt;code&gt;applicationWillEnterForeground&lt;/code&gt; and &lt;code&gt;sceneWillEnterForeground&lt;/code&gt; actually behave the same?&lt;/p&gt;
&lt;h2 id=&#34;difference-1---app-wide-vs-per-scene-calls&#34;&gt;Difference 1 - App-wide vs per-scene calls&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;AppDelegate&lt;/code&gt;’s will enter foreground
&lt;ul&gt;
&lt;li&gt;Fires once when the entire app moves from background to foreground&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;code&gt;SceneDelegate&lt;/code&gt;’s will enter foreground
&lt;ul&gt;
&lt;li&gt;Fires once per scene as each one enters foreground&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;This behaviour is reflected in each method’s signature (look on arguments) ⤵️&lt;/p&gt;</description>
    </item>
    <item>
      <title>Turning Singleton Usage into Testable Code</title>
      <link>https://www.mobiledevdiary.com/posts/turning-singleton-usage-into-testable-code/</link>
      <pubDate>Tue, 27 May 2025 00:00:00 +0000</pubDate>
      <guid>https://www.mobiledevdiary.com/posts/turning-singleton-usage-into-testable-code/</guid>
      <description>&lt;p&gt;See how you can wrap any singleton behind a protocol to make it injectable and your code fully testable 💯&lt;/p&gt;
&lt;p&gt;The blog post shows how to deal with URLSession.shared usage.&lt;/p&gt;
&lt;p&gt;The same strategy can be applied to all other singletons in your code!&lt;/p&gt;
&lt;h2 id=&#34;the-problem&#34;&gt;The problem&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;Service uses &lt;code&gt;URLSession.shared&lt;/code&gt; directly.&lt;/li&gt;
&lt;li&gt;Tight coupling makes unit testing impossible without real network calls.&lt;/li&gt;
&lt;/ul&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-swift&#34; data-lang=&#34;swift&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;struct&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;PostsAPISerivce&lt;/span&gt; {
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#66d9ef&#34;&gt;func&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;fetchPosts&lt;/span&gt;() async &lt;span style=&#34;color:#66d9ef&#34;&gt;throws&lt;/span&gt; -&amp;gt; [Post] {
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        &lt;span style=&#34;color:#66d9ef&#34;&gt;let&lt;/span&gt; url = URL(string: &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;.../posts&amp;#34;&lt;/span&gt;)&lt;span style=&#34;color:#f92672&#34;&gt;!&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        &lt;span style=&#34;color:#66d9ef&#34;&gt;let&lt;/span&gt; (data, &lt;span style=&#34;color:#66d9ef&#34;&gt;_&lt;/span&gt;) = &lt;span style=&#34;color:#66d9ef&#34;&gt;try&lt;/span&gt; await URLSession.shared.data(from: url)
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        &lt;span style=&#34;color:#66d9ef&#34;&gt;return&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;try&lt;/span&gt; JSONDecoder().decode([Post].&lt;span style=&#34;color:#66d9ef&#34;&gt;self&lt;/span&gt;, from: data)
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    }
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;}
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;In the sections, you’ll get step-by-step guide of making this service testable. These same steps can be applied to all other singletons found in your code.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Swift Concurrency Riddle - TaskLocal</title>
      <link>https://www.mobiledevdiary.com/posts/task-local-riddle/</link>
      <pubDate>Sat, 17 May 2025 00:00:00 +0000</pubDate>
      <guid>https://www.mobiledevdiary.com/posts/task-local-riddle/</guid>
      <description>&lt;h2 id=&#34;intro&#34;&gt;Intro&lt;/h2&gt;
&lt;p&gt;If you&amp;rsquo;re able to solve this, it means you understand TaskLocal really well.&lt;/p&gt;
&lt;h2 id=&#34;riddle&#34;&gt;Riddle&lt;/h2&gt;
&lt;p&gt;Look at the attached code snippet and guess:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;What will be printed at each step?&lt;/li&gt;
&lt;li&gt;Is the order of prints always the same?&lt;/li&gt;
&lt;/ul&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-swift&#34; data-lang=&#34;swift&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;class&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;Riddler&lt;/span&gt; {
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    @TaskLocal &lt;span style=&#34;color:#66d9ef&#34;&gt;static&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;var&lt;/span&gt; message = &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;Hello&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#66d9ef&#34;&gt;static&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;func&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;riddleMe&lt;/span&gt;() {
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        &lt;span style=&#34;color:#66d9ef&#34;&gt;Self&lt;/span&gt;.&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;$&lt;/span&gt;message
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;          .withValue(&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;Bye&amp;#34;&lt;/span&gt;, operation: {
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;              print(&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;Print 1: &lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;\(&lt;/span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;Self&lt;/span&gt;.message&lt;span style=&#34;color:#e6db74&#34;&gt;)&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt;) &lt;span style=&#34;color:#75715e&#34;&gt;// ???&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;              Task {
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;                  print(&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;Print 2: &lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;\(&lt;/span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;Self&lt;/span&gt;.message&lt;span style=&#34;color:#e6db74&#34;&gt;)&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt;) &lt;span style=&#34;color:#75715e&#34;&gt;// ???&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;              }
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;              Task.detached {
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;                print(&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;Print 3: &lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;\(&lt;/span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;Self&lt;/span&gt;.message&lt;span style=&#34;color:#e6db74&#34;&gt;)&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt;) &lt;span style=&#34;color:#75715e&#34;&gt;// ???&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;              }
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;          })
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        print(&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;Print 4: &lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;\(&lt;/span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;Self&lt;/span&gt;.message&lt;span style=&#34;color:#e6db74&#34;&gt;)&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt;) &lt;span style=&#34;color:#75715e&#34;&gt;// ???&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    }
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;}
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;Riddler.riddleMe()
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id=&#34;hint&#34;&gt;Hint&lt;/h3&gt;
&lt;p&gt;Do you want to learn more about TaskLocal and Test Scoping in Swift 6.1 first? - Check out my blog post on &amp;ldquo;Concurrency-Safe Testing in Swift 6.1 with TaskLocal and Test Scoping&amp;rdquo; &lt;a href=&#34;https://www.mobiledevdiary.com/posts/concurency-safe-testing-in-swift-6-1/&#34;&gt;HERE&lt;/a&gt;.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Concurrency-Safe Testing in Swift 6.1 with @TaskLocal and Test Scoping</title>
      <link>https://www.mobiledevdiary.com/posts/concurency-safe-testing-in-swift-6-1/</link>
      <pubDate>Wed, 07 May 2025 00:00:00 +0000</pubDate>
      <guid>https://www.mobiledevdiary.com/posts/concurency-safe-testing-in-swift-6-1/</guid>
      <description>&lt;p&gt;Today’s example shows a static property providing the current date.&lt;/p&gt;
&lt;p&gt;Perfect mechanism when we don’t want to inject it everywhere where it’s used.&lt;/p&gt;
&lt;p&gt;How to test it? Check it out ⤵️&lt;/p&gt;
&lt;h2 id=&#34;initial-setup&#34;&gt;Initial setup&lt;/h2&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-swift&#34; data-lang=&#34;swift&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;let&lt;/span&gt; currentDateFormatter: DateFormatter = {
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#66d9ef&#34;&gt;let&lt;/span&gt; formatter = DateFormatter()
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    formatter.dateStyle = .short
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    formatter.timeStyle = .&lt;span style=&#34;color:#66d9ef&#34;&gt;none&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#66d9ef&#34;&gt;return&lt;/span&gt; formatter
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;}()
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;var&lt;/span&gt; currentDateFormatted: String {
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    currentDateFormatter.string(from: DateEnvironment.currentDate())
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;}
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;enum&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;DateEnvironment&lt;/span&gt; {
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#66d9ef&#34;&gt;static&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;var&lt;/span&gt; currentDate: () -&amp;gt; Date = Date.&lt;span style=&#34;color:#66d9ef&#34;&gt;init&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;}
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;extension&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;Date&lt;/span&gt; {
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#75715e&#34;&gt;// 16.04.2025&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#66d9ef&#34;&gt;static&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;let&lt;/span&gt; sixteenthOfApril = Date(timeIntervalSince1970: &lt;span style=&#34;color:#ae81ff&#34;&gt;1744840515&lt;/span&gt;)
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;}
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id=&#34;old-way---xctest&#34;&gt;Old way - XCTest&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;Override the static property in tests.&lt;/li&gt;
&lt;li&gt;Works, but not concurrency-safe (Ok, for XCTest because test ran serially).&lt;/li&gt;
&lt;/ul&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-swift&#34; data-lang=&#34;swift&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;class&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;CurrentDateFormatterTests&lt;/span&gt;: XCTestCase {
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#66d9ef&#34;&gt;func&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;test_dateFormatting&lt;/span&gt;() { &lt;span style=&#34;color:#75715e&#34;&gt;// ✅&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        DateEnvironment.currentDate = { .sixteenthOfApril }
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        XCTAssertEqual(currentDateFormatted, &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;16.04.2025&amp;#34;&lt;/span&gt;)
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    }
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;}
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id=&#34;swift-testing-before-swift-61&#34;&gt;Swift Testing before Swift 6.1&lt;/h2&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-swift&#34; data-lang=&#34;swift&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;enum&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;DateEnvironment&lt;/span&gt; {
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    @TaskLocal &lt;span style=&#34;color:#66d9ef&#34;&gt;static&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;var&lt;/span&gt; currentDate: () -&amp;gt; Date = Date.&lt;span style=&#34;color:#66d9ef&#34;&gt;init&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;}
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;struct&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;CurrentDateFormatterTests&lt;/span&gt; {
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    @Test
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#66d9ef&#34;&gt;func&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;dateFormatting&lt;/span&gt;() { &lt;span style=&#34;color:#75715e&#34;&gt;// ✅&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        DateEnvironment.&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;$&lt;/span&gt;currentDate
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;            .withValue({ .sixteenthOfApril }) {
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;                #expect(currentDateFormatted == &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;16.04.2025&amp;#34;&lt;/span&gt;)
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;            }
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    }
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;}
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Why @TaskLocal?&lt;/p&gt;</description>
    </item>
    <item>
      <title>3 Ways to Name Parameters in Swift Parametrised Tests</title>
      <link>https://www.mobiledevdiary.com/posts/3-ways-to-name-parameters-in-swift-parametrised-tests/</link>
      <pubDate>Thu, 24 Apr 2025 00:00:00 +0000</pubDate>
      <guid>https://www.mobiledevdiary.com/posts/3-ways-to-name-parameters-in-swift-parametrised-tests/</guid>
      <description>&lt;p&gt;Mind your argument names in Swift Testing&amp;rsquo;s parametrised tests!&lt;/p&gt;
&lt;p&gt;As a follow up to my recent post on refactoring to use Swift Testing&amp;rsquo;s parametrised tests, I&amp;rsquo;m diving into the crucial - yet often overlooked topic of how to name your parametrised test inputs.&lt;/p&gt;
&lt;h2 id=&#34;option-1-first-named-tuples&#34;&gt;Option 1: First Named Tuples&lt;/h2&gt;
&lt;p&gt;Only the first tuple is named, all others rely on positional matching to (a, b, result).&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;✅ Minimal boilerplate for small input sets&lt;/li&gt;
&lt;li&gt;❌ Readability drops after adding more cases&lt;/li&gt;
&lt;li&gt;❌ Easy to mix up arguments position&lt;/li&gt;
&lt;li&gt;❌ Hard to scan or extend&lt;/li&gt;
&lt;/ul&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-swift&#34; data-lang=&#34;swift&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;func&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;add&lt;/span&gt;(&lt;span style=&#34;color:#66d9ef&#34;&gt;_&lt;/span&gt; a: Int, &lt;span style=&#34;color:#66d9ef&#34;&gt;_&lt;/span&gt; b: Int) -&amp;gt; Int {
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    a &lt;span style=&#34;color:#f92672&#34;&gt;+&lt;/span&gt; b
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;}
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;...
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;@Test(arguments: [
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    (a: &lt;span style=&#34;color:#ae81ff&#34;&gt;1&lt;/span&gt;, b: &lt;span style=&#34;color:#ae81ff&#34;&gt;2&lt;/span&gt;, result: &lt;span style=&#34;color:#ae81ff&#34;&gt;3&lt;/span&gt;),
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    (&lt;span style=&#34;color:#ae81ff&#34;&gt;10&lt;/span&gt;, &lt;span style=&#34;color:#ae81ff&#34;&gt;15&lt;/span&gt;, &lt;span style=&#34;color:#ae81ff&#34;&gt;25&lt;/span&gt;),
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    (&lt;span style=&#34;color:#ae81ff&#34;&gt;1&lt;/span&gt;, &lt;span style=&#34;color:#f92672&#34;&gt;-&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;5&lt;/span&gt;, &lt;span style=&#34;color:#f92672&#34;&gt;-&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;4&lt;/span&gt;),
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    (&lt;span style=&#34;color:#f92672&#34;&gt;-&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;1&lt;/span&gt;, &lt;span style=&#34;color:#f92672&#34;&gt;-&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;5&lt;/span&gt;, &lt;span style=&#34;color:#f92672&#34;&gt;-&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;6&lt;/span&gt;),
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    (&lt;span style=&#34;color:#ae81ff&#34;&gt;0&lt;/span&gt;, &lt;span style=&#34;color:#ae81ff&#34;&gt;0&lt;/span&gt;, &lt;span style=&#34;color:#ae81ff&#34;&gt;0&lt;/span&gt;),
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    (&lt;span style=&#34;color:#ae81ff&#34;&gt;1000&lt;/span&gt;, &lt;span style=&#34;color:#ae81ff&#34;&gt;1000&lt;/span&gt;, &lt;span style=&#34;color:#ae81ff&#34;&gt;2000&lt;/span&gt;),
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    (&lt;span style=&#34;color:#ae81ff&#34;&gt;10000&lt;/span&gt;, &lt;span style=&#34;color:#ae81ff&#34;&gt;50000&lt;/span&gt;, &lt;span style=&#34;color:#ae81ff&#34;&gt;60000&lt;/span&gt;),
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    (&lt;span style=&#34;color:#f92672&#34;&gt;-&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;10&lt;/span&gt;, &lt;span style=&#34;color:#f92672&#34;&gt;-&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;3&lt;/span&gt;, &lt;span style=&#34;color:#f92672&#34;&gt;-&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;13&lt;/span&gt;)
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;])
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;func&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;add_returnsCorrectSum&lt;/span&gt;(a: Int, b: Int, result: Int) {
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    #expect(add(a, b) == result)
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;}
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id=&#34;option-2-named-tuples&#34;&gt;Option 2: Named Tuples&lt;/h2&gt;
&lt;p&gt;Every tuple entry explicitly names all its fields (a: &amp;hellip;, b: &amp;hellip;, result: &amp;hellip;) for all cases.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Swift Testing Challange - Can you refactor this?</title>
      <link>https://www.mobiledevdiary.com/posts/swift-testing-challange-can-you-refactor-this/</link>
      <pubDate>Thu, 17 Apr 2025 00:00:00 +0000</pubDate>
      <guid>https://www.mobiledevdiary.com/posts/swift-testing-challange-can-you-refactor-this/</guid>
      <description>&lt;h2 id=&#34;intro&#34;&gt;Intro&lt;/h2&gt;
&lt;p&gt;Have you already started using Swift Testing instead of XCTest?&lt;/p&gt;
&lt;p&gt;I&amp;rsquo;m curious to see how you can refactor the test function (&lt;code&gt;add_returnsCorrectSum&lt;/code&gt;) from the code snippet to use all powers of the Swift Testing framework.&lt;/p&gt;
&lt;p&gt;Could you explain what benefits does your refactored version has compared to my original code snippet?&lt;/p&gt;
&lt;p&gt;&lt;img alt=&#34;before_refactor&#34; loading=&#34;lazy&#34; src=&#34;https://www.mobiledevdiary.com/posts/swift-testing-challange-can-you-refactor-this/images/before_refactor.png&#34;&gt;&lt;/p&gt;
&lt;h2 id=&#34;my-approach&#34;&gt;My approach&lt;/h2&gt;
&lt;p&gt;&lt;img alt=&#34;after_refactor&#34; loading=&#34;lazy&#34; src=&#34;https://www.mobiledevdiary.com/posts/swift-testing-challange-can-you-refactor-this/images/after_refactor.png&#34;&gt;&lt;/p&gt;
&lt;p&gt;In both approaches the test gives the same result.&lt;/p&gt;
&lt;p&gt;The point is the refactored version uses a Swift Testing parametrised test, and this makes a real difference.&lt;/p&gt;</description>
    </item>
    <item>
      <title>#3 Swift code refactor in action - a sneaky problem hidden in code snippet</title>
      <link>https://www.mobiledevdiary.com/posts/series/swift-code-refactor/3/</link>
      <pubDate>Wed, 09 Apr 2025 00:00:00 +0000</pubDate>
      <guid>https://www.mobiledevdiary.com/posts/series/swift-code-refactor/3/</guid>
      <description>&lt;p&gt;Swift code refactor in action 👨🏻‍💻&lt;/p&gt;
&lt;p&gt;Take a close look at the validate function. There&amp;rsquo;s a sneaky problem hidden in this code snippet.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;What will the function call return when passed &lt;code&gt;nil&lt;/code&gt;?&lt;/li&gt;
&lt;li&gt;What problem is hidden here?&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;img alt=&#34;initial_code_snippet&#34; loading=&#34;lazy&#34; src=&#34;https://www.mobiledevdiary.com/posts/series/swift-code-refactor/3/images/cover.png&#34;&gt;&lt;/p&gt;
&lt;p&gt;First, the guard statement is redundant here. We can simplify the function to ⤵️&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-swift&#34; data-lang=&#34;swift&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;func&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;validate&lt;/span&gt;(password: String?) -&amp;gt; Bool {
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    password?.count ?? &lt;span style=&#34;color:#ae81ff&#34;&gt;0&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;&amp;gt;&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;8&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;}
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;There&amp;rsquo;s no need to wrap password?.count ?? 0 in parentheses since the &lt;code&gt;??&lt;/code&gt; operator already has higher precedence than &lt;code&gt;&amp;gt;&lt;/code&gt;.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Imperative, Functional, Functional Reactive: Do you know the difference?</title>
      <link>https://www.mobiledevdiary.com/posts/imperative-functional-frp/</link>
      <pubDate>Tue, 25 Feb 2025 00:00:00 +0000</pubDate>
      <guid>https://www.mobiledevdiary.com/posts/imperative-functional-frp/</guid>
      <description>&lt;h1 id=&#34;paradigms&#34;&gt;Paradigms&lt;/h1&gt;
&lt;h2 id=&#34;imperative&#34;&gt;Imperative&lt;/h2&gt;
&lt;p&gt;In the imperative approach, we have a sequence of instructions that describe step by step how the program&amp;rsquo;s state is modified.&lt;/p&gt;
&lt;p&gt;Let&amp;rsquo;s look on the example ⤵️&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-swift&#34; data-lang=&#34;swift&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;var&lt;/span&gt; value = &lt;span style=&#34;color:#ae81ff&#34;&gt;0&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;func&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;increment&lt;/span&gt;() {
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    value &lt;span style=&#34;color:#f92672&#34;&gt;+=&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;1&lt;/span&gt; &lt;span style=&#34;color:#75715e&#34;&gt;// Mutating the state&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;}
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;print(value) &lt;span style=&#34;color:#75715e&#34;&gt;// 0&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;increment()
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;print(value) &lt;span style=&#34;color:#75715e&#34;&gt;// 1&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;In the code we have a mutable variable &lt;code&gt;value&lt;/code&gt; and a function &lt;code&gt;increment&lt;/code&gt; that mutates the state (&lt;code&gt;value&lt;/code&gt;). We first print the initial value, then increment it, and finally print the updated value.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Imperative, Functional, Functional Reactive</title>
      <link>https://www.mobiledevdiary.com/quizzes/imperative_functional_frp/</link>
      <pubDate>Sun, 16 Feb 2025 00:00:00 +0000</pubDate>
      <guid>https://www.mobiledevdiary.com/quizzes/imperative_functional_frp/</guid>
      <description>&lt;p&gt;Do You Know the Difference Between Imperative, Functional, and Reactive Programming?&lt;/p&gt;
&lt;p&gt;Test your understanding of imperative, functional, and functional reactive programming with this interactive quiz. These questions cover the key concepts from the main post to help you solidify your knowledge for your next interview.&lt;/p&gt;
&lt;div class=&#39;quizdown&#39;&gt;
  

---
primary_color: green
secondary_color: lightgray
text_color: black
shuffle_questions: false
shuffle_answers: true
---

# What is functional programming about?

1. [ ] Writing functions that may modify state as needed
1. [x] Avoiding side effects and state mutation
1. [ ] Relying on side effects to manage state transitions
1. [ ] Emphasizing object-oriented design patterns

# In functional programming, why must functions avoid side effects?

1. [ ] To improve performance
1. [x] To prevent unpredictable state changes
1. [ ] To enable state mutation
1. [ ] To allow recursion

# Which paradigm describes a sequence of instructions that modify the program’s state step by step?

1. [ ] Functional
1. [ ] Functional Reactive
1. [x] Imperative
1. [ ] Declarative

# What is considered a side effect in a function?

1. [ ] Returning a computed value
1. [x] Modifying a variable outside its scope
1. [ ] Calling another pure function
1. [ ] Using recursion

# How is state typically managed in functional programming?

1. [ ] By mutating global variables
1. [x] By transforming old state into new state
1. [ ] By ignoring state changes
1. [ ] By centralizing state in a single object

# Which pattern is used by functional reactive programming?

1. [ ] Singleton
1. [ ] Factory
1. [ ] Delegate and Callback
1. [x] Publisher and Subscriber

# What is the primary benefit of using pure functions?

1. [ ] They allow state mutations
1. [x] They are easier to test and debug
1. [ ] They increase code complexity
1. [ ] They require global variables

# Examine the code below. Does it fully follow the functional programming principles?

```swift
var value = 0

func increment(_ value: Int) -&amp;gt; Int {
    value + 1
}

value = increment(value)
print(value)
```
1. [ ] Yes, it&amp;#39;s correct
1. [ ] No, the function has side effects
1. [x] No, it mutates state by reassigning a mutable variable
1. [ ] No, it mutates the &amp;#34;value&amp;#34; variable inside the increment function


&lt;/div&gt;

&lt;p&gt;Didn&amp;rsquo;t get the full result? No worries! All the answers are in the blog post &lt;a href=&#34;https://www.mobiledevdiary.com/posts/imperative-functional-frp/&#34;&gt;HERE&lt;/a&gt;&lt;/p&gt;</description>
    </item>
    <item>
      <title>#7 XCTest vs Swift Testing: A modern way of linking bugs</title>
      <link>https://www.mobiledevdiary.com/posts/series/swift-testing-vs-xctest/7-bugs-linking/</link>
      <pubDate>Fri, 13 Dec 2024 00:00:00 +0000</pubDate>
      <guid>https://www.mobiledevdiary.com/posts/series/swift-testing-vs-xctest/7-bugs-linking/</guid>
      <description>&lt;h3 id=&#34;whats-the-difference&#34;&gt;What’s the difference?&lt;/h3&gt;
&lt;p&gt;In XCTest we relied on the old fashioned simple comments to add more context to our test case e.g link to the bug description.&lt;/p&gt;
&lt;p&gt;With Swift Testing, we now have a special &lt;code&gt;bug&lt;/code&gt; trait that can be passed to the &lt;code&gt;@Test&lt;/code&gt; macro. The &lt;code&gt;bug&lt;/code&gt; trait takes a URL String as argument and optionally a title for the bug allowing us to add short description of it. The key advantage over regular comment is that the bug title is visible in the test results. Better yet, tapping on it takes you directly to the related webpage with the bug report.&lt;/p&gt;</description>
    </item>
    <item>
      <title>#6 XCTest vs Swift Testing - Parameterized tests in the fight for more reusable code</title>
      <link>https://www.mobiledevdiary.com/posts/series/swift-testing-vs-xctest/6-parametrized-tests/</link>
      <pubDate>Thu, 05 Dec 2024 00:00:00 +0000</pubDate>
      <guid>https://www.mobiledevdiary.com/posts/series/swift-testing-vs-xctest/6-parametrized-tests/</guid>
      <description>&lt;h3 id=&#34;whats-the-difference&#34;&gt;What’s the difference?&lt;/h3&gt;
&lt;p&gt;XCTest doesn&amp;rsquo;t provide a built-in solution for parameterized tests. To achieve this, we create test cases as structs or tuples, defining test inputs and expected results. Then, we write a loop to iterate through these test cases and execute the necessary assertions.&lt;/p&gt;
&lt;p&gt;Swift Testing simplifies this process by allowing tests to be parameterized directly. Using the &lt;code&gt;@Test&lt;/code&gt; macro, you can pass test cases as an argument. What&amp;rsquo;s the benefit? While you still need to define your test cases, the iteration code is no longer needed — Swift Testing handles it for you.&lt;/p&gt;</description>
    </item>
    <item>
      <title>#2 Swift code refactor in action - price $$$</title>
      <link>https://www.mobiledevdiary.com/posts/series/swift-code-refactor/2/</link>
      <pubDate>Tue, 03 Dec 2024 00:00:00 +0000</pubDate>
      <guid>https://www.mobiledevdiary.com/posts/series/swift-code-refactor/2/</guid>
      <description>&lt;p&gt;Swift code refactor in action 👨🏻‍💻&lt;/p&gt;
&lt;p&gt;Today, let’s talk about refactoring for clarity, maintainability, and scalability!&lt;/p&gt;
&lt;p&gt;This time, the scenario is calculating the final price depending on the price and membership status.&lt;/p&gt;
&lt;p&gt;This initial code has a few code smells:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;1️⃣ nested ifs - impacts general readability, making the code hard to understand,&lt;/li&gt;
&lt;li&gt;2️⃣ duplicated conditions - &amp;ldquo;price &amp;gt; 100&amp;rdquo; which violates the Don’t Repeat Yourself principle,&lt;/li&gt;
&lt;li&gt;3️⃣ lack of scalability - not possible to easily add a new discount, it’d require to rework everything.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Checkout the gif or the post on my website to see how I solve these code smells and make the code cool, clean and scalable!&lt;/p&gt;</description>
    </item>
    <item>
      <title>#5 XCTest vs. Swift Testing - Conditional disabling - when a test needs a nap</title>
      <link>https://www.mobiledevdiary.com/posts/series/swift-testing-vs-xctest/5-conditional-disabling/</link>
      <pubDate>Thu, 28 Nov 2024 00:00:00 +0000</pubDate>
      <guid>https://www.mobiledevdiary.com/posts/series/swift-testing-vs-xctest/5-conditional-disabling/</guid>
      <description>&lt;p&gt;Today we check the diff in conditional disabling.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;In XCTest there is &lt;code&gt;XCTSkipIf&lt;/code&gt; function that takes &lt;code&gt;Bool&lt;/code&gt; argument to decide whether a test should run or not.&lt;/li&gt;
&lt;li&gt;In Swift Testing there’s &amp;ldquo;disable&amp;rdquo; trait accepting &lt;code&gt;Bool&lt;/code&gt; argument and behaving like &lt;code&gt;XCTSkipIf&lt;/code&gt; from XCTest.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;XCTSkipIf - are you surprised this kind of function exists? To be honest - I was&lt;/p&gt;
&lt;p&gt;I can admit I learned about it when preparing this post. This already shows how often I’ll be using the Swift Testing version of it, but never say never!&lt;/p&gt;</description>
    </item>
    <item>
      <title>#4 XCTest vs. Swift Testing - Disable tests - handle with care</title>
      <link>https://www.mobiledevdiary.com/posts/series/swift-testing-vs-xctest/4-disable-tests/</link>
      <pubDate>Wed, 27 Nov 2024 00:00:00 +0000</pubDate>
      <guid>https://www.mobiledevdiary.com/posts/series/swift-testing-vs-xctest/4-disable-tests/</guid>
      <description>&lt;p&gt;This week with Swift Testing starts with checking how test disabling differs from XCTest.&lt;/p&gt;
&lt;p&gt;In XCTest, Xcode identifies a function as a test only if its name starts with the &amp;ldquo;test&amp;rdquo; prefix, so putting e.g. &amp;ldquo;disabled&amp;rdquo; instead makes the test inactive.
Swift Testing simplifies that approach by introducing the @Test macro with a &lt;code&gt;.disabled&lt;/code&gt; trait that you can pass as an argument.&lt;/p&gt;
&lt;p&gt;What’s the benefit?
You no longer need to modify each test name to disable it. What’s more, you can include context directly within the trait to justify why the test is disabled.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Two types of Swift macros</title>
      <link>https://www.mobiledevdiary.com/posts/two-types-of-swift-macros/</link>
      <pubDate>Tue, 26 Nov 2024 00:00:00 +0000</pubDate>
      <guid>https://www.mobiledevdiary.com/posts/two-types-of-swift-macros/</guid>
      <description>&lt;h3 id=&#34;what-is-macro&#34;&gt;What is macro?&lt;/h3&gt;
&lt;p&gt;💡 Macro is a feature that generates code during compilation. Unlike macros in C, which work like “find and replace”, Swift macros are type-safe and context aware, making them powerful tools reducing boilerplate code.&lt;/p&gt;
&lt;p&gt;Two types of macros&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;attached - use &lt;code&gt;@&lt;/code&gt; prefix, tied to a declaration adding extra logic to it, like: &lt;code&gt;@Test&lt;/code&gt;, &lt;code&gt;@Model&lt;/code&gt;, &lt;code&gt;@Observable&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;freestanding - use &lt;code&gt;#&lt;/code&gt; prefix, standalone code that can be invoked independently as a part of the code, like &lt;code&gt;#expect&lt;/code&gt;, &lt;code&gt;#Predicate&lt;/code&gt;, &lt;code&gt;#warning&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Example of attached macro ⤵️&lt;/p&gt;</description>
    </item>
    <item>
      <title>#3 XCTest vs. Swift Testing - Unwrapping optionals</title>
      <link>https://www.mobiledevdiary.com/posts/series/swift-testing-vs-xctest/3-unwrapping-optionals/</link>
      <pubDate>Thu, 21 Nov 2024 00:00:00 +0000</pubDate>
      <guid>https://www.mobiledevdiary.com/posts/series/swift-testing-vs-xctest/3-unwrapping-optionals/</guid>
      <description>&lt;p&gt;Optionals are a core of Swift - we deal with them daily, both in production and testing code. Whether you write tests with XCTest or Swift Testing, unwrapping optionals is a common case.&lt;/p&gt;
&lt;p&gt;In XCTest there is &lt;code&gt;XCTUnwrap&lt;/code&gt; operator.&lt;/p&gt;
&lt;p&gt;Swift Testing introduces &lt;code&gt;#require&lt;/code&gt; macro.&lt;/p&gt;
&lt;p&gt;Is there any difference between them? Not really! Both require the test function to handle exceptions and &lt;code&gt;try&lt;/code&gt; keyword before.&lt;/p&gt;
&lt;p&gt;Gif ⤵️&lt;/p&gt;
&lt;p&gt;&lt;img alt=&#34;Example&#34; loading=&#34;lazy&#34; src=&#34;https://www.mobiledevdiary.com/posts/series/swift-testing-vs-xctest/3-unwrapping-optionals/images/example.gif&#34;&gt;&lt;/p&gt;
&lt;p&gt;Code ⤵️&lt;/p&gt;
&lt;p&gt;XCTest&lt;/p&gt;</description>
    </item>
    <item>
      <title>#1 Swift code refactor in action - user profile name</title>
      <link>https://www.mobiledevdiary.com/posts/series/swift-code-refactor/1/</link>
      <pubDate>Wed, 20 Nov 2024 00:00:00 +0000</pubDate>
      <guid>https://www.mobiledevdiary.com/posts/series/swift-code-refactor/1/</guid>
      <description>&lt;p&gt;Swift code refactor in action 👨🏻‍💻&lt;/p&gt;
&lt;p&gt;Common scenario: formatting user profile name - I bet any of you faced this kind of task.&lt;/p&gt;
&lt;p&gt;At first glance, it look straightforward, but when you take a closer look, you’ll notice two potential improvements:&lt;/p&gt;
&lt;p&gt;1️⃣ One single return - simplification of the function flow.&lt;/p&gt;
&lt;p&gt;2️⃣ Centralised formatting logic - reduces the chance of bugs.&lt;/p&gt;
&lt;p&gt;Check out the animated gif and the code where I refactor to address these issues.&lt;/p&gt;</description>
    </item>
    <item>
      <title>#2 XCTest vs. Swift Testing - Has error testing been simplified?</title>
      <link>https://www.mobiledevdiary.com/posts/series/swift-testing-vs-xctest/2-has-error-testing-been-simplified/</link>
      <pubDate>Tue, 19 Nov 2024 00:00:00 +0000</pubDate>
      <guid>https://www.mobiledevdiary.com/posts/series/swift-testing-vs-xctest/2-has-error-testing-been-simplified/</guid>
      <description>&lt;p&gt;Today we check how testing error has changed in the new framework.&lt;/p&gt;
&lt;p&gt;In XCTest, we use &lt;code&gt;XCTAssertThrowsError&lt;/code&gt; to check if a specific error is thrown. This assertion comes with the error handler closure where we can perform additional checks like e.g. verifying the exact error type.&lt;/p&gt;
&lt;p&gt;With Swift Testing, this process is even simpler, especially when an error conforms to &lt;code&gt;Equatable&lt;/code&gt;. We can directly specify the expected error in the expect macro and it automatically checks the type.&lt;/p&gt;</description>
    </item>
    <item>
      <title>#1 XCTest vs. Swift Testing - fresh look on a new testing framework</title>
      <link>https://www.mobiledevdiary.com/posts/series/swift-testing-vs-xctest/1-fresh-look-on-a-new-testing-framework/</link>
      <pubDate>Thu, 14 Nov 2024 00:00:00 +0000</pubDate>
      <guid>https://www.mobiledevdiary.com/posts/series/swift-testing-vs-xctest/1-fresh-look-on-a-new-testing-framework/</guid>
      <description>&lt;p&gt;New Series! XCTest vs. Swift Testing - fresh look on a new testing framework.&lt;/p&gt;
&lt;p&gt;Swift Testing was presented at WWDC24 as a new, modern, simplified framework for writing automated tests. It&amp;rsquo;s a perfect candidate to replace XCTest unit tests, so it&amp;rsquo;s definitely worth learning.&lt;/p&gt;
&lt;p&gt;I haven’t had a chance yet to use Swift Testing in production and the series is my motivation for me to discover it.&lt;/p&gt;
&lt;p&gt;Today we cover 2 basic differences ⤵️&lt;/p&gt;</description>
    </item>
    <item>
      <title>TDD with SwiftUI - Triggering API request</title>
      <link>https://www.mobiledevdiary.com/posts/series/testing-swiftui-code-in-tdd/testing-swiftui-code-in-tdd-button-action-request/</link>
      <pubDate>Fri, 13 Sep 2024 00:00:00 +0000</pubDate>
      <guid>https://www.mobiledevdiary.com/posts/series/testing-swiftui-code-in-tdd/testing-swiftui-code-in-tdd-button-action-request/</guid>
      <description>&lt;h2 id=&#34;recap&#34;&gt;Recap&lt;/h2&gt;
&lt;p&gt;Hello everyone and welcome to the next chapter of the series about SwiftUI code automated testing!&lt;/p&gt;
&lt;p&gt;In the previous post we&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;defined acceptance criteria for the Joke app that we&amp;rsquo;re implementing&lt;/li&gt;
&lt;li&gt;we covered by snapshot tests all UI cases mentioned in the acceptance critieria&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;That&amp;rsquo;s what the app looks like ⤵️&lt;/p&gt;
&lt;p&gt;&lt;img alt=&#34;joke_app_designs&#34; loading=&#34;lazy&#34; src=&#34;https://www.mobiledevdiary.com/posts/series/testing-swiftui-code-in-tdd/testing-swiftui-code-in-tdd-button-action-request/images/joke_app_designs.png&#34;&gt;&lt;/p&gt;
&lt;p&gt;Here&amp;rsquo;s the link to the previous blog post ⤵️ (Worth reading before this one)&lt;/p&gt;
&lt;p&gt;&lt;a href=&#34;https://www.mobiledevdiary.com/posts/testing-swiftui-code-the-beginning/&#34;&gt;Testing SwiftUI Code - The beginning (UI)&lt;/a&gt;&lt;/p&gt;</description>
    </item>
    <item>
      <title>Swift Testing parametrized tests</title>
      <link>https://www.mobiledevdiary.com/posts/swift-testing-parametrized-tests/</link>
      <pubDate>Mon, 12 Aug 2024 00:00:00 +0000</pubDate>
      <guid>https://www.mobiledevdiary.com/posts/swift-testing-parametrized-tests/</guid>
      <description>&lt;p&gt;Swift Testing can elevate your unit tests writing 🚀&lt;/p&gt;
&lt;p&gt;Hello Apple Developer! I prepared a special post that will help you write better unit tests using the new SwiftTesting framework 🫢&lt;/p&gt;
&lt;p&gt;The Swift Testing framework is the successor to XCTest for unit tests. It was introduced at this year&amp;rsquo;s WWDC24 and is worth learning 📚&lt;/p&gt;
&lt;p&gt;One of the main features of Swift Testing are parameterized tests 🧪&lt;/p&gt;
&lt;p&gt;Click to learn how to leverage this new feature ⤵️&lt;/p&gt;</description>
    </item>
    <item>
      <title>Insights about Swift Testing Tags</title>
      <link>https://www.mobiledevdiary.com/posts/insights-about-swift-testing-tags/</link>
      <pubDate>Thu, 11 Jul 2024 00:00:00 +0000</pubDate>
      <guid>https://www.mobiledevdiary.com/posts/insights-about-swift-testing-tags/</guid>
      <description>&lt;p&gt;Today, I have a special post about Apple&amp;rsquo;s new testing framework - Swift Testing! 🤩&lt;/p&gt;
&lt;p&gt;Swift Testing was presented at WWDC24 as a new, modern, simplified framework for writing automated tests. It&amp;rsquo;s a perfect candidate to replace XCTest unit tests, so it&amp;rsquo;s definitely worth learning 🧑‍🏫&lt;/p&gt;
&lt;p&gt;The topic of Swift Testing is quite broad, so I decided to break it down into more digestible parts, starting with Swift Testing Tags. What is this? 🤔&lt;/p&gt;</description>
    </item>
    <item>
      <title>My WWDC 2017 Scholarship submission</title>
      <link>https://www.mobiledevdiary.com/posts/my-wwdc-2017-scholarship-submission/</link>
      <pubDate>Mon, 10 Jun 2024 00:00:00 +0000</pubDate>
      <guid>https://www.mobiledevdiary.com/posts/my-wwdc-2017-scholarship-submission/</guid>
      <description>&lt;h2 id=&#34;intro&#34;&gt;Intro&lt;/h2&gt;
&lt;p&gt;This year’s WWDC is just around the corner, and I decided to write about how I ended up at WWDC in 2017. At that time, I was a computer science student and Apple was organizing Swift Student Challange for which I was eligible for. As a young iOS apprentice, I couldn&amp;rsquo;t miss this opportunity - I signed up. How did I get there? That&amp;rsquo;s what I want to share with you today. ⤵️&lt;/p&gt;</description>
    </item>
    <item>
      <title>Testing SwiftUI Code - The beginning (UI)</title>
      <link>https://www.mobiledevdiary.com/posts/series/testing-swiftui-code-in-tdd/testing-swiftui-code-the-beginning/</link>
      <pubDate>Thu, 06 Jun 2024 00:00:00 +0000</pubDate>
      <guid>https://www.mobiledevdiary.com/posts/series/testing-swiftui-code-in-tdd/testing-swiftui-code-the-beginning/</guid>
      <description>&lt;h2 id=&#34;intro&#34;&gt;Intro&lt;/h2&gt;
&lt;p&gt;Hello everyone and welcome to my first (ever) blog series!&lt;/p&gt;
&lt;p&gt;Today, I&amp;rsquo;m going to begin experimenting with SwiftUI. The mission is to build a small application and having it fully tested 💯. I decided to go for that quest to broaden my knowledge around SwiftUI and verify the rumors that it cannot be tested.&lt;/p&gt;
&lt;p&gt;To keep it relatively readable I decided to split it up and we&amp;rsquo;re going to see how many parts we end up with.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Combine: flatMap, map &#43; switchToLatests (flatMapLatest) demystified</title>
      <link>https://www.mobiledevdiary.com/posts/combine-flatmap-map-switchtolatest-demystified/</link>
      <pubDate>Thu, 11 Apr 2024 00:00:00 +0000</pubDate>
      <guid>https://www.mobiledevdiary.com/posts/combine-flatmap-map-switchtolatest-demystified/</guid>
      <description>&lt;h2 id=&#34;intro&#34;&gt;Intro&lt;/h2&gt;
&lt;p&gt;Combine is a framework made by Apple designed to support us in writing code that could be way more complex if written in an imperative way. It&amp;rsquo;s often said that with great power comes great responsibility. Therefore, as developers, it’s essential for us to understand how to harness it, so it does not backfire.&lt;/p&gt;
&lt;p&gt;Today, we&amp;rsquo;re going to take a closer look 👀 at a few Combine operators, showcasing their practical application.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Testing SwiftData and the Query property wrapper through an example</title>
      <link>https://www.mobiledevdiary.com/posts/testing-swiftdata-and-the-query-property-wrapper-through-an-example/</link>
      <pubDate>Sun, 25 Jun 2023 00:00:00 +0000</pubDate>
      <guid>https://www.mobiledevdiary.com/posts/testing-swiftdata-and-the-query-property-wrapper-through-an-example/</guid>
      <description>&lt;p&gt;We’re just after this year’s WWDC where we had a chance to witness the unveiling of a new persistence framework called SwiftData. Naturally, I couldn’t resist delving deeper into it. One particular topic that caught my attention was the observation of local storage using Query and its testability.&lt;/p&gt;
&lt;p&gt;&lt;img alt=&#34;intro_image&#34; loading=&#34;lazy&#34; src=&#34;https://www.mobiledevdiary.com/posts/testing-swiftdata-and-the-query-property-wrapper-through-an-example/images/intro_image.jpeg&#34;&gt;&lt;/p&gt;
&lt;h3 id=&#34;swiftdata&#34;&gt;SwiftData&lt;/h3&gt;
&lt;blockquote&gt;
&lt;p&gt;SwiftData makes it easy to persist data using declarative code. You can query and filter data using regular Swift code. And it’s designed to integrate seamlessly with SwiftUI.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Keep your project clean using synx</title>
      <link>https://www.mobiledevdiary.com/posts/keep-your-project-clean-using-synx/</link>
      <pubDate>Thu, 21 Oct 2021 00:00:00 +0000</pubDate>
      <guid>https://www.mobiledevdiary.com/posts/keep-your-project-clean-using-synx/</guid>
      <description>&lt;p&gt;A tool written in Ruby which can keep your project and a .pbxproj file clean. A valuable ally when solving complex conflicts inside the project file.&lt;/p&gt;
&lt;p&gt;Keeping a project file clean during a project life could be tough especially while working in a team, and we conflict our branches from time to time. Solving multiple conflicts in a .pbxproj can lead to mistakes that can cause duplicated references, not removed old references, or files not referenced by a project, but still existing in a project directory. In today’s article, I’ll share my tips on how to deal with described problems pretty easily.&lt;/p&gt;</description>
    </item>
    <item>
      <title></title>
      <link></link>
      <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
      <guid></guid>
      <description>&lt;hr&gt;
&lt;p&gt;Thanks for reading. 📖&lt;/p&gt;
&lt;p&gt;I hope you found it useful!&lt;/p&gt;
&lt;p&gt;If you enjoy the topic don&amp;rsquo;t forget to follow me on one of my social media - &lt;a href=&#34;https://www.linkedin.com/in/maciej-gomolka/&#34;&gt;LinkedIn&lt;/a&gt;, &lt;a href=&#34;https://twitter.com/gomolka_maciej&#34;&gt;X&lt;/a&gt;, &lt;a href=&#34;https://mastodon.social/@gomolka&#34;&gt;Mastodon&lt;/a&gt;, &lt;a href=&#34;https://bsky.app/profile/maciejgomolka.bsky.social&#34;&gt;Bluesky&lt;/a&gt; or via &lt;a href=&#34;https://www.mobiledevdiary.com/index.xml&#34;&gt;RSS&lt;/a&gt; feed to keep up to speed. 🚀&lt;/p&gt;</description>
    </item>
    <item>
      <title>About</title>
      <link>https://www.mobiledevdiary.com/about/</link>
      <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
      <guid>https://www.mobiledevdiary.com/about/</guid>
      <description>&lt;figure class=&#34;align-center &#34;&gt;
    &lt;img loading=&#34;lazy&#34; src=&#34;maciej.png#center&#34;
         alt=&#34;Maciej&#34; width=&#34;70%&#34;/&gt; 
&lt;/figure&gt;

&lt;p&gt;My adventure with the iOS platform started over &lt;strong&gt;eight years&lt;/strong&gt; ago. I belong to a generation of developers who started out learning how to create mobile iOS applications in &lt;strong&gt;Swift&lt;/strong&gt;, but I&amp;rsquo;m also familiar with Objective-C.&lt;/p&gt;
&lt;p&gt;During over eight years of work, I’ve created &lt;strong&gt;7 applications in Swift&lt;/strong&gt; from scratch. The experience allowed me to test many solutions, as well as design patterns (MVC, MVVM, Redux) and frameworks in practice.&lt;/p&gt;</description>
    </item>
  </channel>
</rss>
