How to Create a Checkbox in SwiftUI Using ToggleStyle
The SwiftUI framework comes with a built-in checkbox, but it’s only available on the macOS platform. If you want to use checkboxes on iOS, you have to build your own component. Previously, we’ve covered ToggleStyle to...
Using ToggleStyle to Build Custom Toggles in SwiftUI
Toggle in SwiftUI is one of the most used views that it allows users to switch between two states, either on or off. This control is a great way to provide a simple and intuitive interface for your users, making it a popular...
Building a QR Code Scanner App in SwiftUI
So, what’s QR code? I believe most of you know what a QR code is. In case you haven’t heard of it, just take a look at the above image – that’s a QR code. QR (short for Quick Response) code is a kind of...
Working with the new NavigationStack in SwiftUI
In iOS development, navigation view is definitely one of the most commonly used components. When SwiftUI was first released, it came with a view called NavigationView for developers to build navigation-based user interfaces. With...
Switching Layout Using SwiftUI AnyLayout
Starting from iOS 16, SwiftUI provides AnyLayout and the Layout protocol for developers to create customized and complex layouts. AnyLayout is a type-erased instance of the layout protocol. You can use AnyLayout to create a...
Mastering SwiftUI for iOS 16 and Xcode 14 is Now Released
As you know, Apple released Xcode 14 and iOS 16, along with the debut of iPhone 14. Now our Mastering SwiftUI book is updated to support the latest version of iOS and Xcode. All the content including screenshots and...
How to Use SwiftUI Gauge and Create Custom Gauge Styles in iOS 16
In iOS 16, SwiftUI introduces a new view called Gauge for displaying progress. You can actually use it to show values within a range. In this tutorial, let’s see how to use the Gauge view and work with different gauge...
A Beginner’s Guide to NavigationSplitView in SwiftUI for iOS 16
In iOS 16, other than introducing the new NavigationStack, Apple also released a new view container named NavigationSplitView for developers to create two or three column navigation interface. If you want to build UI similar to...
How to Use PhotosPicker in SwiftUI
Prior to iOS 16, if you need to display a photo picker for users to choose photos from Photo library, you have to rely on PHPickerViewController or the older UIImagePickerController of UIKit. It’s not difficult to use it as...
SwiftUI ImageRenderer: How to Create PDF Documents
Earlier, we showed you how to use ImageRenderer to capture a SwiftUI view and save it as an image. This new class, introduced in iOS 16, can also let you convert a view into a PDF document. In this tutorial, we will build on the...