Chapter 3: Viewing while Building with SwiftUI Preview
Developing an application requires several interactions between clients and developers. The clients may sometimes request minor changes, such as colors, fonts, and the position of items in the design. Previously, developers would need to update their design in Xcode and recompile all the code. iOS 13 solves this problem by introducing canvas previews. Previews allow the instant review and update of design changes without recompiling the whole code.
In this chapter, we will learn how to make effective use of Xcode previews to speed up the UI development time. The chapter includes the following recipes:
- Previewing the layout in dark mode
- Previewing the layout at different dynamic type sizes
- Previewing the layout in a navigation view
- Previewing the layout on different devices
- Using previews in UIKit
- Using mock data for previews