In my Swift playground, I entered the following code to test the live view feature:
let view = UIView()
PlaygroundPage.current.liveView = view
But for some reason the live view doesn't display on the right in the Assistant Editor. Initially I thought that Xcode wasn't finished running the playground. But I waited and waited and it still doesn't show.
Any help?
I had this same exact issue. I found a temporary solution.
What I noticed is that if I opened more than one Xcode project it would cause this error. So Just completely quit xcode (command Q) and only open the live playground you are trying to work on and it should work.
Make sure you have the following imports and you might want to give it a frame and color just to make sure it is actually working since your view does not have a frame or color. This code works for me.
import UIKit
import PlaygroundSupport
let view = UIView()
view.backgroundColor = .white
view.frame = CGRect(x: 0, y: 0, width: 100, height: 100)
PlaygroundPage.current.liveView = view