To get the most out of this book
Inform the reader the things that they need to know before they start: spell out what knowledge you are assuming. Tell the reader anything they need to know before they start.
This book has been completely revised for Swift 5, iOS 17, Xcode 15, and Swift 5.9.
To build all the apps in this book, you will need:
- A Mac computer running macOS Ventura 13.5 or later. For Chapter 16, you’ll need macOS 14.0 Sonoma or later.
- Xcode 15.0 or later.
The book extensively uses the live preview of the Xcode canvas to introduce the learning material and occasionally uses the iOS simulator. If you want to test the apps on your iPhone or iPad, you will need to obtain a free Apple Developer account from Apple at https://developer.apple.com.
If you are using the digital version of this book, we advise you to type the code yourself or access the code from the book’s GitHub repository (a link is available in the next section). Doing so will help you to avoid any potential errors related to the copying and pasting of code.
Download the example code files
The code bundle for the book is hosted on GitHub at https://github.com/PacktPublishing/SwiftUI-Cookbook-3rd-Edition. We also have other code bundles from our rich catalog of books and videos available at https://github.com/PacktPublishing/. Check them out!
Download the color images
We also provide a PDF file that has color images of the screenshots/diagrams used in this book. You can download it here: https://packt.link/gbp/9781805121732.
Conventions used
There are a number of text conventions used throughout this book.
CodeInText
: Indicates code words in text, database table names, folder names, filenames, file extensions, pathnames, dummy URLs, user input, and Twitter handles. For example: “Mount the downloaded WebStorm-10*.dmg
disk image file as another disk in your system.”
A block of code is set as follows:
Chart {
ForEach(data) { entry in
BarMark(
x: .value("Question", entry.question),
y: .value("Count", entry.count)
)
}
}
When we wish to draw your attention to a particular part of a code block, the relevant lines or items are set in bold:
struct TodoItem: Identifiable {
let id = UUID()
var title: String
}
Bold: Indicates a new term, an important word, or words that you see on the screen. For instance, words in menus or dialog boxes appear in the text like this. For example: “Tap on the + button a few times and then on the Refresh button”.
Warnings or important notes appear like this.
Tips and tricks appear like this.
Sections
In this book, you will find several headings that appear frequently (Getting ready, How to do it..., How it works..., There’s more..., and See also).
To give clear instructions on how to complete a recipe, use these sections as follows:
Getting ready
This section tells you what to expect in the recipe and describes how to set up any software or any preliminary settings required for the recipe.
How to do it…
This section contains the step-by-step instructions required to build the app of the recipe. Screenshots and explanatory figures are provided along with the code snippets.
How it works…
This section usually consists of a detailed explanation of the steps followed in the previous section. It explains in detail the code snippets and technologies used in the recipe.
There’s more…
This optional section covers additional topics related to the recipe to make you more knowledgeable about the technologies used to build the app.
See also
This optional section provides helpful links to other useful information about the technologies used in the recipe.