Xcode 8 playground live view doesn't work

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

playground live view


In Xcode 9.0 as well as having:

PlaygroundPage.current.needsIndefiniteExecution = true

You have to manually open the assistant editor then the playground with current focus will show the UIView.


I had the same issue as well and the following line of code fixed it for me:

PlaygroundPage.current.needsIndefiniteExecution = true

Setting a live view is supposed to auto-enable it for you, but for me it wasn't doing it. Must be a bug in Xcode.