Quantcast
Channel: SwiftUI Archives - SwiftLee
Browsing index pages (37 articles)

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...

View Article


@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...

View Article


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...

View Article

SwiftUI Agent Skill: Build better views with AI

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...

View Article

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...

View Article


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...

View Article

@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...

View Article

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...

View Article


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...

View Article


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...

View Article

SwiftUI Grid, LazyVGrid, LazyHGrid Explained with Code Examples

SwiftUI Grid, LazyVGrid, and LazyHGrid are UI elements that allow you to place views in a structured grid. You can control the horizontal and vertical spacing, columns, and rows. You typically use the...

View Article

SwiftUI TabView: Explained with Code Examples

The SwiftUI TabView allows you to create a tabbed view and is a great container for several of your main views. Each tab displays another main view, allowing your user to quickly switch between the...

View Article

Picker in SwiftUI explained with code examples

The picker control in SwiftUI allows you, as a developer, to create a UI element for users to select from a set of values. It comes in different styles, and the segmented control and menu picker styles...

View Article


How to develop an app for iOS

You have a great app idea but you wonder: how to develop an app for iOS? Where do I even start? You might also question whether it’s even realistic to think you’re able to build an app for iOS...

View Article

SwiftUI Lists: Present rows of data explained with code examples

SwiftUI Lists allow you, as a developer, to present rows of data. It’s one of the most commonly used elements when building apps and the core of many navigation flows. Presenting rows of data is simply...

View Article


SwiftUI Button: Custom Styles, Variants, and Best Practices

SwiftUI allows you to create buttons in different styles, both custom and default configurations. You can define reusable button styles or quickly get started using SwiftUI modifiers specifically...

View Article

@Entry macro: Creating custom environment values in SwiftUI

The @Entry macro in SwiftUI allows you to define custom environment values without writing boilerplate code. While introduced in Xcode 16, you can use it from iOS 13 and up since it’s a Swift Macro...

View Article


Memory consumption when loading UIImage from disk

Memory consumption can quickly increase if you load many images from the disk using UIImage. You’ll generally load images from a remote address or via an asset catalog. However, you have bundled images...

View Article

Why macOS Development is Perfect for Indie Developers

Building apps for macOS offers developers a fantastic opportunity to expand their skills, create useful utilities to solve their problems, and begin their journey as indie developers. I’ve invited...

View Article

@Previewable: Dynamic SwiftUI Previews Made Easy

Xcode 16 introduced the @Previewable macro for SwiftUI Previews, allowing you to use dynamic properties inline in previews. You’ll be able to make richer and more dynamic previews of your SwiftUI views...

View Article
Browsing index pages (37 articles)


Latest Images