Using previews in UIKit
Xcode previews provide a fast and easy way to quickly preview the current state of your view. Previews were introduced in Xcode 11 together with SwiftUI. You might think previews can only be used on SwiftUI apps, but you'll be wrong. UIKit apps can also make use of this great new feature!
In this recipe, we will set up a UIKit view to make it "previewable" in the Xcode canvas.
If you have not yet done so, download the GitHub repository for this book from https://github.com/PacktPublishing/SwiftUI-Cookbook.
How to do it…
- Open the initial iOS 12 XCode project located at https://github.com/PacktPublishing/SwiftUI-Cookbook/tree/master/Chapter03%20-%20Viewing%20while%20building%20with%20SwiftUI%20Preview/05%20...