MLX Swift — On-Device Large Language Models on Apple Silicon

MLX Swift: Enabling On-Device Large Language Models on Apple Silicon

Abstract The proliferation of large-scale neural language models has, until recently, been contingent upon access to remote computational infrastructure. The architectural characteristics of Apple Silicon — most notably its unified memory subsystem — present a substantive departure from this dependency. This article examines MLX Swift, a native Swift binding to Apple’s MLX machine learning framework, as a mechanism for deploying quantized Large Language Models (LLMs) directly on consumer Apple hardware. ...

March 31, 2026 · 14 min · Walid Sassi

Getting Started with Claude Code for Xcode 26: Setup, Pricing & Monitoring Guide

The landscape of iOS development has dramatically shifted in 2025. With Apple’s introduction of Xcode 26 at WWDC 2025, which integrates ChatGPT and supports multiple AI models through API keys, and Anthropic’s release of Claude Code as a powerful command-line tool for agentic coding, developers now have unprecedented AI-powered development capabilities. ...

September 2, 2025 · 6 min · Walid Sassi

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

Building Interactive Timelines in SwiftUI: From Static Views to Draggable Events

Ever wondered how to build intercative that feel natural and responsive? The kind where users can drag events and see real-timeupdates? SwiftUI’s combination of GeometryReader, alignementGuide, and gesture handling makes this suprisingly elegant. Let’s build from scratch and the understand the magic behind positioning elements on a timeline. The Challenge: Positioning Events in Time magine you need to visualize events that occur over time — think of a video timeline, project milestones, or async operations. The core challenge is: How do you position an element at a specific time on a timeline of unknown width? ...

August 3, 2025 · 6 min · Walid Sassi

Understanding SwiftUI ViewBuilder: The Magic Behind Declarative Syntax

SwiftUI’s declarative syntax often feels like magic. You can write natural-looking code with if statements, multiple view expressions, even loops — and somehow, it all just works. But how? The secret lies in ViewBuilder — one of Swift’s most powerful tools that transforms your declarative code into optimized SwiftUI types. Let’s dive into what makes this possible. The Foundation: Result Builders Before focusing on ViewBuilder itself, it’s important to understand what it’s built on: Swift’s Result Builder system (previously called Function Builders). ...

July 16, 2025 · 4 min · Walid Sassi

Custom Conditional ViewBuilders in SwiftUI: Advanced Patterns and Pitfalls

Remember when we first discovered @ViewBuilder in Part 1? That moment when everything clicked and you thought “wow, I can create my own SwiftUI-style components!” It was pretty exciting, wasn’t it? The declarative syntax, the composability, the way it all just… worked. Well, I hate to be the bearer of bad news, but today we’re going to talk about a pattern that might seem like the next logical step—but is actually a beautiful trap waiting to catch enthusiastic SwiftUI developers. ...

July 5, 2025 · 6 min · Walid Sassi

Understanding `@ViewBuilder` in SwiftUI: Build Custom Views with Declarative Syntax

SwiftUI’s @ViewBuilder is a powerful attribute that enables us to create custom view components with a declarative and flexible syntax — just like native SwiftUI containers (VStack, HStack, etc.). In this article, we’ll explore: What is @ViewBuilder and why it matters How to create a custom view that accepts a @ViewBuilder closure What happens under the hood when SwiftUI processes a @ViewBuilder closure Practical use cases and benefits What is @ViewBuilder? @ViewBuilder is a special attribute that lets you write multiple views inside a closure, and SwiftUI will automatically combine them into a single view result. It acts like a function builder specialized for views. ...

June 28, 2025 · 2 min · Walid Sassi

Understanding Dependency Cycles: How SparkDI Uses DFS for Detection

Imagine you’re building a house of cards. Each card depends on others for support, creating a delicate but stable structure. Now imagine two cards needed to support each other simultaneously — it would be physically impossible to build. This is exactly the problem we face with dependencies in software development. 🔁 A Real-World Example In this scenario: AuthenticationService needs UserService to verify user permissions UserService needs ProfileService to get user details ProfileService needs AuthenticationService to access secure data This creates an impossible situation: none of these services can be initialized because each depends on another that isn’t yet created. It’s like trying to solve the classic chicken-and-egg problem. ...

February 24, 2025 · 2 min · Walid Sassi