Create a SwiftUI View in a Swift Playground
Learn how to create a SwiftUI based view and display it in a Swift Playground using Xcode. This will work with Xcode 11+. This can be done with just a few lines of code.
For some reason, even in Xcode 12 (Beta), there is no option to create a single view based on SwiftUI so I also suggest a way to deal with that. Currently, it will create a UIKit view.
Having access to SwiftUI views in Swift Playgrounds are a great time saver, you no longer have to create a project just to play around with an idea or learn something new.
Back