What this book covers
Chapter 1, Using the Basic SwiftUI Views and Controls, explains the basic building blocks for creating SwiftUI apps and how to integrate UIKit components in SwiftUI views.
Chapter 2, Displaying Scrollable Content with Lists and Scroll Views, explains how to use using List
views and ScrollView
containers to display content when it does not fit on a single screen. You’ll also be able to learn about editable and searchable lists.
Chapter 3, Exploring Advanced Components, explains how to use LazyStack
and Lazy Grid
to improve performance when displaying large datasets. Also, you’ll learn how to programmatically scroll with ScrollViewReader
, display hierarchical data in an expanding list, and hide and show content with DisclosureGroup
. Finally, you’ll learn how to display glanceable content outside your app using SwiftUI Widgets.
Chapter 4, Viewing while Building with SwiftUI Preview in Xcode 15, explains how to use the preview macro introduced with Swift 5.9 with the powerful live preview in the Xcode 15 canvas.
Chapter 5, Creating New Components and Grouping Views with Container Views, explains how to use Form views for user interaction, Table for multi-column lists, and Grid for powerful two-dimensional layouts.
Chapter 6, Presenting Views Modally, explains how to display custom views for narrow and focused user interaction, using alerts, confirmation dialogs, sheets, popovers, and context menus.
Chapter 7, Navigation Containers, explains how to use NavigationStack
for hierarchical, data-driven navigation, NavigationSplitView
for multi-column user interfaces, and TabView
for navigation among non-hierarchical content.
Chapter 8, Drawing with SwiftUI, explains how to implement drawings in SwiftUI by using built-in shapes and drawing custom paths and polygons.
Chapter 9, Animating with SwiftUI, explains how to implement basic animations, spring animations, implicit and delayed animations, as well as how to combine transitions, create custom transitions, and create asymmetric transitions. Additionally, you’ll also be able to learn how to perform chained animations with PhaseAnimator
and full-custom animations with KeyFrameAnimator
.
Chapter 10, Driving SwiftUI with Data, explains how to use the SwiftUI binding mechanism to populate and change views when the bounded data changes. At the end of the chapter, you’ll learn about the Observation framework and the Observable macro, introduced with iOS 17.
Chapter 11, Driving SwiftUI with Combine, explains how to integrate Combine to drive the changes of the SwiftUI views. You’ll explore how to validate forms, fetch data asynchronously from the network, and test Combine-based apps.
Chapter 12, SwiftUI Concurrency with async await, explains how to implement Swift concurrency with async await, fetching from a network resource, and creating an infinite scrolling page.
Chapter 13, Handling Authentication and Firebase with SwiftUI, explains how to implement authentication in your app and store app data in a cloud database.
Chapter 14, Persistence in SwiftUI with Core Data and Swift Data, explains how to implement persistence using SwiftUI and Core Data. You’ll learn how to save, delete, and modify objects in a Core Data local database. You’ll also learn how to use Swift Data, the new persistence framework introduced with iOS 17.
Chapter 15, Data Visualization with Swift Charts, explains how to use Swift Charts for data visualization. You’ll learn how to plot different types of charts using a few building blocks and powerful view modifiers. You’ll discover interactive charts and range charts using real-world examples. You’ll also learn how to transform your data to simplify the visualization process.
Chapter 16, Creating Multiplatform Apps with SwiftUI, explains how to create a multiplatform SwiftUI app that works on iOS 17, macOS 14 Sonoma, and watchOS 10.
Chapter 17, SwiftUI Tips and Tricks, covers several tips and tricks of SwiftUI that will help you to solve several common problems, such as testing SwiftUI views, using custom fonts, showing PDF documents, and using Markdown text.