Reputation: 1724
I try to run some UIKit playground examples and I have problem viewing the graphic results.
What works:
What does not work:
Below is some sample code I try to use:
import UIKit
import PlaygroundSupport
let containerView = UIView(frame: CGRect(x: 0.0, y: 0.0, width: 375.0, height: 667.0))
let circle = UIView(frame: CGRect(x: 0.0, y: 0.0, width: 50.0, height: 50.0))
circle.center = containerView.center
circle.layer.cornerRadius = 25.0
let button = UIButton(type: .detailDisclosure)
containerView.addSubview(button)
let startingColor = UIColor(red: (253.0/255.0), green: (159.0/255.0), blue: (47.0/255.0), alpha: 1.0)
circle.backgroundColor = startingColor
containerView.addSubview(circle);
PlaygroundPage.current.liveView = containerView
Is there anything more I should do run the playground? There's a related question: Playground not showing results where OP is asked if he set the device in the simulator. Well, in my case I didn't but I don't know where to do it. The simulator is not running.
EDIT:
I've seen the question marked as possible duplicate with accepted answer not working for me and the other one mentioning partial solution (only quick and inline previews). So to rephrase my question: In Xcode 8.2 should I expect to see UIView related results anywhere else than in quick preview (popup) and inline preview (between lines of code)?
Upvotes: 3
Views: 2266
Reputation: 1809
I've had the same issue as you. Here is how I somehow solved it.
It seems that to have the live preview (PlaygroundPage.current.liveView), the playground is starting a simulator. In my case, it was opening an iOS 9 device by default. I guess it was the last one I had used.
Hope it works for you
Upvotes: 4
Reputation: 900
Try if this works:
On the top right hand side, unclick any other buttons and press the below blue highlighted button.
Do you see the graphical view now?
Upvotes: 2
Reputation: 201
You should define what you mean by "large graphical display". Why the solution used in the link (and by you) doesn't match your needs ?
EDIT
Is not a large graphical display ?
Upvotes: 0