<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Donato Gomez on Medium]]></title>
        <description><![CDATA[Stories by Donato Gomez on Medium]]></description>
        <link>https://medium.com/@donatogomez?source=rss-e3ab68329a29------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*tMRTcsWXHpJXVudcTYqGaA.jpeg</url>
            <title>Stories by Donato Gomez on Medium</title>
            <link>https://medium.com/@donatogomez?source=rss-e3ab68329a29------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Fri, 27 Nov 2026 18:55:13 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@donatogomez/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Swift Is Not Just iOS — And Never Was]]></title>
            <link>https://donatogomez.medium.com/swift-beyond-the-apple-ecosystem-an-underused-language-b5f712ca0c90?source=rss-e3ab68329a29------2</link>
            <guid isPermaLink="false">https://medium.com/p/b5f712ca0c90</guid>
            <category><![CDATA[ios-development]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[swift]]></category>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[backend]]></category>
            <dc:creator><![CDATA[Donato Gomez]]></dc:creator>
            <pubDate>Wed, 18 Mar 2026 22:27:26 GMT</pubDate>
            <atom:updated>2026-03-18T22:42:13.978Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vLRypRLzi5-DrcrF55pzCA.png" /><figcaption>Swift beyond the Apple ecosystem</figcaption></figure><h3>Beyond iOS: What Swift Really Is</h3><p>When people talk about Swift, it’s common to associate it directly with building apps for iPhone or iPad. That makes sense, because for years that has been its main use case.</p><p>But that association is <strong>incomplete</strong>.</p><p>Swift is not defined by the platform where it is most used, but by <em>how it is designed</em>. And that’s where the perspective starts to change.</p><p>Reducing Swift to iOS is confusing where it became popular with what it is actually capable of doing. It’s similar to thinking JavaScript is only for manipulating the DOM, or that Python is just a scripting language.</p><p>In all those cases, the initial perception falls short of reality.</p><p>The same happens with Swift. Its design is not only about building interfaces. It addresses broader problems:</p><p><em>how to write safer code,<br>how to manage memory in a predictable way,<br>and how to structure applications without losing clarity.</em></p><p>When you look at it from that angle, Swift stops feeling like a specialized tool and starts to look like <strong>a language with much broader ambitions</strong>.</p><blockquote><strong><em>Swift is not limited by where it was created, but by how it is designed.</em></strong></blockquote><h3>How Swift moved beyond the Apple ecosystem</h3><p>Swift was introduced by Apple in 2014 as a new language for its platforms. That was its starting point — but not its limit.</p><p>In 2015, it was released as an open source project under Swift.org, and that completely changed its nature. From that moment on, Swift was no longer tied exclusively to Apple’s ecosystem. It became <strong>a language with a life of its own</strong>.</p><p>This has important implications. Swift can run on environments like Linux, its compiler does not depend on Xcode, and its evolution is not limited to a single platform.</p><p>This is where confusion usually appears.</p><p>Technologies like <em>SwiftUI</em>, <em>UIKit</em> or <em>AppKit</em> are often associated with Swift, but they are not the language. They are <em>frameworks</em>: sets of tools designed to solve a specific problem — in this case, building interfaces within the Apple ecosystem.</p><p>Swift sits <em>underneath</em> all of that.</p><p>And this distinction, even if it seems obvious, is what allows us to start seeing Swift not as a platform-specific tool, but as <strong>a language with much more potential than it is usually given credit for</strong>.</p><h3>Swift as a General-Purpose language</h3><p>The fact that Swift became popular through app development does not define its real scope.</p><p>Swift is a general-purpose language. That means it can be used in very different contexts, not just for building interfaces or mobile applications.</p><p>And that completely changes the conversation.</p><p>We are no longer talking about a specialized tool, but about <strong>a language that can adapt to different types of problems</strong>.</p><p>Part of that flexibility comes from its design. Swift is compiled, has a strong type system, and a carefully designed memory model, while still maintaining a syntax that is clear and expressive.</p><p>That combination is not very common. Usually, when a language gives you control and performance, it also comes with complexity. Swift tries to break that trade-off, offering a middle ground that is quite unusual.</p><p>That is why it starts to make sense beyond UI development: in business logic, tools, backend systems or automation.</p><p>Not because it tries to replace everything, but because it has <strong>a solid enough foundation to not be confined to a single category</strong>.</p><h3>Designed to Prevent Failure</h3><p>Many of the most serious security issues in software do not come from complex systems, but from simple mistakes that keep happening over and over again.</p><p>Accessing memory that should not be accessed. Using a value that does not exist. Assuming something is valid without checking it.</p><p>Swift takes a different approach.</p><p>Instead of relying entirely on the developer, the language introduces mechanisms that force you to be explicit about certain decisions. Not as a limitation, but as a way to <strong>reduce errors before they even happen</strong>.</p><p>For example, optionals make it clear when a value might not exist. The type system reduces ambiguity, and access to data structures is more controlled.</p><p>On top of that, memory management through ARC automates much of the object lifecycle, avoiding many classic issues.</p><p>The result is not a perfect language, but one where <strong>certain types of errors become much harder to introduce without noticing</strong>.</p><p>And that is a meaningful shift in terms of security.</p><blockquote><strong><em>Some errors in Swift are not just unlikely… they become impossible to represent.</em></strong></blockquote><h3>Modern Concurrency — Built In</h3><p>Concurrency is one of the hardest problems in software development, and many languages have built their solutions on top of models that were not originally designed for it.</p><p>Swift takes a different path.</p><p>Instead of adding layers over an old model, concurrency is integrated directly into the language.</p><p>With async/await, asynchronous code becomes easier to read and reason about. The flow stays close to sequential code, avoiding much of the complexity found in other approaches.</p><p>But the most interesting change is how shared state is handled.</p><p>Through mechanisms like actors, Swift forces developers to be more aware of what data is shared and how it is accessed across concurrent tasks.</p><p>This does not eliminate problems entirely, but it makes them <strong>more visible and harder to ignore</strong>.</p><p>And as the language evolves — especially with Swift 6 — the compiler starts detecting situations that previously could go unnoticed.</p><p>In practice, this means you not only can write concurrent code, but you also have <strong>better tools to do it in a controlled way</strong>.</p><h3>The Perception Problem</h3><p>If Swift has such a solid foundation, the question becomes inevitable: why is it still seen almost exclusively as an iOS language?</p><p>The answer is not technical. It is contextual.</p><p>Swift grew within a very specific ecosystem, and its main showcase has always been Apple app development. That has shaped how it is presented and how people learn it.</p><p>On top of that, there is industry inertia.</p><p>In backend, tooling or systems, there are already well-established languages with large communities and mature ecosystems. Changing that is not just about having a good language — it is about changing habits.</p><p>Swift, even though it has the capabilities to compete in many of those areas, has not yet had the momentum outside Apple to break that barrier.</p><p>At its core, the issue is quite simple.</p><blockquote><strong><em>The limitation of Swift is not technical. It is perception.</em></strong></blockquote><h3>What comes next</h3><p>At this point, the conversation changes.</p><p>It is no longer about what Swift is, but about how far it can go.</p><p>What happens when Swift is used for backend development?<br>Does it make sense for tools or scripting?<br>How does it compare to languages like Go or Rust?<br>And what about its expansion beyond the Apple ecosystem?</p><p>These are the questions that will define its future.<br>Because if something is clear, it is this:</p><blockquote><strong><em>Swift does not seem to be limited by the language itself.</em></strong></blockquote><p>And that is where things start to get interesting.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b5f712ca0c90" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[ Understanding @MainActor in SwiftUI: A Practical Guide for Swift 6]]></title>
            <link>https://donatogomez.medium.com/understanding-mainactor-in-swiftui-a-practical-guide-for-swift-6-69e657872ec5?source=rss-e3ab68329a29------2</link>
            <guid isPermaLink="false">https://medium.com/p/69e657872ec5</guid>
            <category><![CDATA[swiftui]]></category>
            <category><![CDATA[swift]]></category>
            <category><![CDATA[ios-development]]></category>
            <category><![CDATA[swift-concurrency]]></category>
            <category><![CDATA[swift-6]]></category>
            <dc:creator><![CDATA[Donato Gomez]]></dc:creator>
            <pubDate>Tue, 20 May 2025 10:29:12 GMT</pubDate>
            <atom:updated>2025-05-21T07:10:35.398Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gwhW_Fg2wAvyD2H26y2gLg.png" /></figure><p>Since async/await and actors (actor) arrived in Swift, you’ve probably seen <strong>MainActor pop up everywhere.</strong></p><p>And yes, it <em>sounds important</em> — but also confusing:</p><ul><li><strong>Should I use it on all my view models?</strong></li><li><strong>What happens if I don’t?</strong></li><li><em>Isn’t SwiftUI already running everything on the main thread?</em></li></ul><p>If you’re building apps with <strong>SwiftUI and Swift 6</strong>, this article will save you some bugs, some headaches, and a lot of unnecessary boilerplate.</p><h3>🧩 What is MainActor, really?</h3><p>Think of MainActor as <strong>a safety gate</strong>. It tells Swift:</p><blockquote>“Whatever happens here must run on the main thread.”</blockquote><p>That matters, because <strong>only the main thread can safely update the UI</strong>.<br>If you try to change UI-related values from a background thread, <strong>Swift 6 won’t let you</strong> — and that’s a good thing.</p><h3>🧪 But doesn’t SwiftUI already run on the main thread?</h3><p>Yes… but only <em>partially</em>.</p><p>SwiftUI runs things like .body, button actions, and view updates on the main thread.</p><p>But if you launch a task with Task{...}and update some state <strong>without using </strong>@MainActor, things can go wrong.</p><p>And with <strong>Swift 6’s strict concurrency model</strong>, the compiler will now <strong>tell you immediately</strong> when something is unsafe.</p><h3>🧨 Example that fails without @MainActor</h3><pre>@Observable<br>final class CounterModel {<br>    var count: Int = 0<br><br>    func incrementAfterDelay() {<br>        Task {<br>            try? await Task.sleep(for: .seconds(1))<br>            count += 1 // ❌ Swift 6: Data race!<br>        }<br>    }<br>}</pre><p>Swift 6 throws a concurrency violation here:</p><blockquote>“Mutation of ‘count’ is not isolated to the main actor.”</blockquote><p>This used to be silent in older versions of Swift. <br>Now, Swift protects you — <strong>but you need to cooperate.</strong></p><h3>✅ When SHOULD you use @MainActor?</h3><p>Use it <strong>whenever your model updates values that the UI observes</strong> — for example, with @Observable.</p><pre>@Observable<br>@MainActor<br>final class CounterModel {<br>    var count: Int = 0<br><br>    func incrementAfterDelay() {<br>        Task {<br>            try? await Task.sleep(for: .seconds(1))<br>            count += 1 // ✅ Safe, isolated to MainActor<br>        }<br>    }<br><br>    func reset() {<br>        count = 0<br>    }<br>}</pre><p><strong>Why mark the whole class?</strong><br>Because it’s <strong>clean</strong>, <strong>simple</strong>, and now all methods and properties become <strong>safe by default</strong>.</p><h3>📦 Complete example: SwiftUI + @MainActor</h3><p>Let’s build a mini app called MainActorCounter to test this pattern.</p><pre>MainActorCounter/<br>├── Models/<br>│   └── CounterModel.swift<br>├── Views/<br>│   └── CounterView.swift<br>├── MainActorCounterApp.swift</pre><h3>CounterView.swift</h3><pre>import SwiftUI<br><br>struct CounterView: View {<br>    @State private var model = CounterModel() // keeps instance alive<br><br>    var body: some View {<br>        VStack(spacing: 16) {<br>            Text(&quot;Count: \(model.count)&quot;)<br>                .font(.largeTitle)<br>            Button(&quot;Increment after delay&quot;) {<br>                model.incrementAfterDelay()<br>            }<br>            Button(&quot;Reset&quot;) {<br>                model.reset()<br>            }<br>        }<br>        .padding()<br>    }<br>}</pre><h3>🧠 Why @State here?</h3><p>Not for observation — that’s @Observable’s job.</p><p>We use @State<strong>just to keep the model alive during view updates.</strong><br>If you remove it, the model might reset every time the view redraws (e.g. after a navigation).</p><h3>⚖️ Quick reference: When to use @MainActor</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/892/1*XqXQrJG4vA7s9VMpAS2izQ.png" /></figure><h3>🧪 GitHub example</h3><p>You can explore the full working code here:<br>👉 <a href="http://github.com/donatogomez/MainActorCounter">github.com/donatogomez/MainActorCounter</a></p><p>It includes:</p><ul><li>✅ Safe version with @MainActor</li><li>❌ Unsafe version with Swift 6 error</li><li>📚 A clean README.md for learners</li></ul><h3>💬 Final thoughts</h3><p>In Swift 6, @MainActorisn’t just a “<em>nice to have</em>”— it’s <strong>essential</strong> for writing <strong>safe, modern SwiftUI code</strong>.</p><p>But don’t overuse it.<br>Use it <strong>only when working with UI-bound state</strong>.<br>Let your background logic live outside the main thread — and your app (and your sanity) will thank you.</p><h3>💬 Let’s connect</h3><p>Enjoyed this?</p><p>👉 Connect with me on <a href="https://www.linkedin.com/in/tu-perfil">LinkedIn</a><br>👉 Check out my <a href="https://github.com/donatogomez">GitHub profile</a></p><p>I write about Swift, architecture, and developer clarity — always with a focus on modern, native solutions aligned with Swift’s evolution.</p><p>☕ If this article saved you time:</p><p>👉 <a href="https://www.buymeacoffee.com/tuusuario">Buy Me a Coffee</a></p><p>Thanks for reading 🙌</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=69e657872ec5" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[ Reactive Swift Without Combine or Rx]]></title>
            <link>https://donatogomez.medium.com/reactive-swift-without-combine-or-rx-a35a5ba31e08?source=rss-e3ab68329a29------2</link>
            <guid isPermaLink="false">https://medium.com/p/a35a5ba31e08</guid>
            <category><![CDATA[ios-development]]></category>
            <category><![CDATA[concurrency]]></category>
            <category><![CDATA[swift]]></category>
            <category><![CDATA[reactive-programming]]></category>
            <category><![CDATA[swiftui]]></category>
            <dc:creator><![CDATA[Donato Gomez]]></dc:creator>
            <pubDate>Tue, 13 May 2025 10:20:39 GMT</pubDate>
            <atom:updated>2025-05-16T10:43:46.427Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*z3gafvy2ppzKCt5q9aWATA.png" /></figure><h3>A modern architecture powered by async/await and Swift 6</h3><p>A few years ago, if you wanted your Swift app to react to stuff — like incoming messages, data updates, or network events — you’d end up deep in <strong>Combine</strong>, <strong>RxSwift</strong>, <strong>NotificationCenter</strong>… and probably some .sink, .map, .receive(on:), and a bit of pain.</p><p>But since <strong>async/await</strong> arrived — and especially with <strong>Swift 6</strong> and its strict concurrency model — things got <em>way</em> simpler.</p><p>Now you can build reactive logic (yes, the kind that updates your UI automatically when something changes) <strong>without needing Combine, Rx, or anything extra</strong>.</p><p>Just <strong>plain Swift</strong>. Cleaner, lighter, and easier to reason about.</p><h3>😰 The usual problem</h3><p>Let’s say you want to display a list of messages — and show new ones as they come in.</p><p>With Combine or Rx, that means publishers, subscriptions, pipelines, and more boilerplate than you’d like to admit.</p><p>But… why not just use what Swift already gives us?</p><h3>🧪 The data stream (a.k.a. message source)</h3><p>Here’s the basic project structure we’ll follow:</p><pre>🗂 Project structure<br><br>ReactiveSwift6Demo/<br>├── Models/<br>│   └── Message.swift<br>├── Services/<br>│   ├── MessageProvider.swift<br>│   └── MockMessageProvider.swift<br>├── ViewModels/<br>│   └── MessageViewModel.swift<br>├── Views/<br>    └── MessageListView.swift</pre><p>First, let’s create a Message model and a service that emits fake messages every 2 seconds:</p><pre>// Message.swift<br>struct Message: Identifiable {<br>    let id = UUID()<br>    let content: String<br>}</pre><pre>// MessageProvider.swift<br>protocol MessageProvider {<br>    func streamMessages() -&gt; AsyncStream&lt;Message&gt;<br>}</pre><pre>// MockMessageProvider.swift<br>final class MockMessageProvider: MessageProvider {<br>    func streamMessages() -&gt; AsyncStream&lt;Message&gt; {<br>        AsyncStream { continuation in<br>            Task {<br>                while !Task.isCancelled {<br>                    try? await Task.sleep(for: .seconds(2))<br>                    let message = Message(content: Self.randomPlaceholder())<br>                    continuation.yield(message)<br>                }<br>                continuation.finish()<br>            }<br>        }<br>    }<br><br>    private static func randomPlaceholder() -&gt; String {<br>        [<br>            &quot;Hello, Swift 6!&quot;,<br>            &quot;Still here?&quot;,<br>            &quot;Async/Await is neat.&quot;,<br>            &quot;Testing message...&quot;,<br>            &quot;Reactive without Rx.&quot;,<br>            &quot;Concurrency feels good!&quot;<br>        ].randomElement()!<br>    }<br>}</pre><p>This AsyncStream is your <strong>reactive engine</strong> — but fully native and concurrency-safe.</p><h3>🎒 The ViewModel</h3><p>Now let’s wire this stream into a reactive view model:</p><pre>// MessageViewModel.swift<br>import Observation<br><br>@Observable<br>@MainActor<br>final class MessageViewModel {<br>    var messages: [Message] = []<br>    private let provider: MessageProvider<br><br>    init(provider: MessageProvider = MockMessageProvider()) {<br>        self.provider = provider<br><br>        Task {<br>            for await message in provider.streamMessages() {<br>                messages.append(message)<br>            }<br>        }<br>    }<br>}</pre><p>No .sink, no @Published, no AnyCancellable.</p><p>Just <strong>native Swift</strong> and @Observable to trigger SwiftUI updates.</p><h3>🖼 The SwiftUI view</h3><pre>// MessageListView.swift<br>struct MessageListView: View {<br>    let viewModel = MessageViewModel()<br><br>    var body: some View {<br>        List(viewModel.messages) { message in<br>            Text(message.content)<br>        }<br>        .navigationTitle(&quot;Reactive Swift&quot;)<br>    }<br>}</pre><p>Every time a new message arrives → it’s appended to the list → SwiftUI updates automatically.</p><h3>✅ Why is this better?</h3><ul><li><strong>No frameworks needed</strong>: everything is native Swift.</li><li><strong>Simpler mental model</strong>: easier to onboard new devs or juniors.</li><li><strong>Easier to test</strong>: inject any MessageProvider you want.</li><li><strong>Fully compatible with Swift 6 strict concurrency</strong>.</li><li><strong>No hidden side effects or custom operators to debug</strong>.</li></ul><h3>🔄 What if you need to push values manually?</h3><p>The example above is a passive stream — it just spits out values every few seconds. But let’s be honest: in real apps, you often need to <em>push</em> stuff yourself — like reacting to a delegate method, a callback, or some user input.</p><p>That’s where AsyncStream with a Continuation comes in. It’s the native way to go full manual — like a send() in Combine or onNext() in Rx — but without bringing in anything external.</p><p>And it gets even better: <strong>Swift 6.2</strong> (coming soon) introduces <strong>Observations</strong> — a new API that turns <em>any</em> property into an AsyncSequence. No continuation, no glue code, no UI required. Just reactivity. Anywhere.</p><h3>🎯 When should you still use Combine?</h3><p>You might still want Combine if:</p><ul><li>You have a legacy codebase already using it.</li><li>You need specific stream operators not covered by AsyncSequence.</li></ul><p>But for new projects — especially if you want <strong>clarity</strong>, <strong>predictability</strong>, and <strong>scalability</strong> —</p><p>async/await + AsyncStream + @Observable is more than enough.</p><h3>💬 Final thoughts</h3><p>Swift has evolved.</p><p>What used to require frameworks and complex pipelines now works with clean, native code.</p><p><strong>No Combine. <br>No RxSwift. <br>No noise.</strong></p><p>Just Swift — the way it was meant to be used.</p><p>Now go build something reactive. <strong>The simple way.</strong></p><h3>📦 Full source code</h3><p>You can explore the complete working project here:<br>👉 <a href="http://github.com/donatogomez/ReactiveSwift6Demo">github.com/donatogomez/ReactiveSwift6Demo</a></p><h3>💬 Let’s connect</h3><p>Enjoyed this?</p><p>👉 <a href="https://www.linkedin.com/in/donatogomez/">Connect with me on LinkedIn</a><br>👉 <a href="https://github.com/donatogomez">Check out my GitHub profile</a></p><p>I write about <strong>Swift</strong>, <strong>architecture</strong>, and <strong>developer clarity</strong> — always with a focus on modern, native solutions aligned with Swift’s evolution.</p><p>If this article helped you or saved you hours of trial and error:</p><p>👉 <a href="https://www.buymeacoffee.com/tuusuariosomalias">Support me on Buy Me a Coffee</a></p><p>Thanks for reading 🙌</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a35a5ba31e08" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>