Back to walidsassi.com

Understanding Swift's isolated Keyword: Parameters and Closures

Swift’s concurrency model introduces actors to provide safe, isolated access to mutable state. However, constantly using await when interacting with actors can create performance bottlenecks and reduce code readability. The isolated keyword offers an elegant solution by allowing synchronous access to actor state in specific contexts. ...

August 18, 2025 · 2 min · Walid Sassi

Integrating Claude API with Xcode 26 Beta 5: A Complete Guide

With the release of Xcode 26, developers now have exciting new possibilities for integrating AI capabilities directly into their development workflow. In this article, I’ll walk you through my experience integrating Claude’s API with Xcode 26 Beta 5, including the cost considerations and token system that you should be aware of. Getting Started: API Key Setup Step 1: Creating Your API Key The first step is to obtain your API key from the Anthropic Console: ...

August 14, 2025 · 2 min · Walid Sassi

Swift Actor Common Pitfall: Parameters Are NOT Protected!

class DownloadCounter { var count = 0 var lastDownload: Date? } actor DownloadManager { private var totalProcessed = 0 // ✅ Protected by actor func processDownload(_ counter: DownloadCounter) async { totalProcessed += 1 // ✅ Safe - actor's state // 💥 DANGER: counter is NOT protected! counter.count += 1 // ❌ Potential data race counter.lastDownload = Date() // ❌ Potential data race } } // Data race scenario func dangerousUsage() async { let counter = DownloadCounter() let manager = DownloadManager() // Thread 1 Task { await manager.processDownload(counter) } // Thread 2 - Concurrent access! Task { counter.count += 5 // 💥 DATA RACE with Thread 1 } } ✅ The Solution: sending to Transfer Ownership ...

August 11, 2025 · 1 min · Walid Sassi