Xcode 11: Canvas does not show up
You need to be on Catalina macOS version (10.15), as stated in official tutorial
Be warned: Catalina doesn't support 32-bit applications, some old apps will stop working after update.
you can still see the live view (without Catalina installed ) with the playgrounds.
using UIHostingController
.
import UIKit
import SwiftUI
import PlaygroundSupport
struct ContentView : View {
var body: some View {
Text("Hello World")
.foregroundColor(Color.blue)
}
}
// Present the view controller in the Live View window
PlaygroundPage.current.liveView = UIHostingController.init(rootView: ContentView())
To further add to the other answer, as per the official tutorial from Apple:
To preview and interact with views from the canvas in Xcode, ensure your Mac is running macOS 10.15 beta.
Unfortunate that I can't run it right now since the beta was just released and I don't have a spare Mac!