SwiftUI
Learn more and get better in building apps with SwiftUI.
iPhone Duo Simulator: Testing and optimizing your SwiftUI app
As soon as the iPhone Duo got announced, we were all waiting for an iPhone Duo Simulator inside Xcode. We eventually got it with the first beta of Xcode 27.1. This Simulator is unlike any other and a lot of fun to explore, allowing you to fold the device into ...
SwiftUI Agent Skill: Install and use with AI coding tools
A SwiftUI Agent Skill that helps you build better views or refactor existing ones. It's the reality we're in today, and I honestly can't live without it anymore myself. Several skills helped me improve the code quality produced by agents, and I'm happy to introduce you to my open-source skill ...
MVVM in SwiftUI: Using view models without overengineering
MVVM in SwiftUI separates a view’s presentation from the state and actions behind it. A view model exposes the values a view displays and handles work such as loading, validation, or deletion, while the view remains focused on rendering. SwiftUI already provides powerful tools for state management, so not every ...
Run cloud agents with Xcode on real Apple SiliconXcloud gives your cloud agents their own macOS environment, complete with your Xcode version, SDKs, and dependencies. They can edit, build, and test iOS or macOS apps while Xcloud handles the infrastructure. Learn more.
@StateObject vs. @ObservedObject: The differences explained
@StateObject and @ObservedObject both connect an ObservableObject to a SwiftUI view. The key difference is ownership: use @StateObject when the view creates the object and @ObservedObject when the view receives it from elsewhere. Choosing the wrong wrapper can cause your model to be recreated whenever SwiftUI rebuilds a view. I ...
SwiftUI Best Practices, straight from Apple’s Xcode 27 Agent Skill
Xcode 27 launched during WWDC 2026 and includes Apple's SwiftUI Agent Skill for the first time. These skills work great for agentic development in Xcode, or when Using Xcode 27’s Agent Skills in Claude, Codex, and Cursor, any AI IDE. While we can use these skills and not look back, ...
SwiftUI Architecture: Structure Views for Reusability and Clarity
As your SwiftUI projects grow, the need for a better SwiftUI architecture grows, as it’s easy for view bodies to become very long. You start with a simple screen, and before you realize it, your body includes dozens of nested VStacks, HStacks, and custom modifiers. At some point, scrolling through the body feels ...
SwiftUI Toggle: A Complete Guide
A SwiftUI Toggle is a common UI element that allows users to switch between states. It often turns a binding value on or off, and it's commonly used for settings or binary choices. In this guide, I’ll walk through everything you need to know about a Toggle in SwiftUI: from ...
@ViewBuilder usage explained with code examples
The @ViewBuilder attribute is one of the few result builders available for you to use in SwiftUI. You typically use it to create child views for a specific SwiftUI view in a readable way without having to use any return keywords. I encourage you to read my article Result builders ...
Universal Links implementation on iOS
Universal Links allow you to link to content inside your app when a user opens a particular URL. Webpages will open in the app browser by default, but you can configure specific paths to open in your app if the user has it installed. This behavior is well known as ...
SwiftUI ForEach Explained with Code Examples
If you're building dynamic lists or repeating UI components in SwiftUI, there's a high chance you're already using the SwiftUI ForEach view element. It's a powerful, yet sometimes misunderstood, view element in SwiftUI. This article will help you understand how ForEach works and when and how to use it. We'll also dive ...
SwiftUI Alert Guide + Code Examples
You can present a SwiftUI Alert using dedicated view modifiers that make it straightforward to present native alerts. It works a bit differently compared to their UIKit variant, but you'll get used to them quickly. In this article, we're going to dive into the SwiftUI Alert functions and I'll demonstrate ...