Using SwiftUI in a Playground

1 · Andrew Bancroft · June 13, 2019, 4 a.m.
If you’re looking for a quicker way to iterate while you’re building SwiftUI views, and you don’t have macOS Catalina installed, you might enjoy the Playground experience more than you enjoy pressing command + R every time you make a change and want to see it in the user interface. How do you do it? Here’s a code snippet to copy-paste into a Playground to get you going. 1import UIKit 2import PlaygroundSupport 3import SwiftUI 4 5// Make a SwiftUI view 6struct ContentView: View { 7 var ...