Amol Kumar
Amol Kumar

Reputation: 63

Xcode Playground - Live view dimensions (Swift)

I am setting dimension of live view in Xcode using

view = UIView(frame: CGRect(x: 0, y: 0, width: 900, height: 675))

And I am getting this in the live view, Screenshot - 900 X 675

Where each square is 100 X 100, to compare the dimensions. So, instead of getting a view of 900 X 675, I am getting a view of around 700(something) X 675.

Another example,

view = UIView(frame: CGRect(x: 0, y: 0, width: 800, height: 600))

Screenshot - 800 X 600

So, is this a bug with Xcode Playground or am I doing something wrong? I am using the code below to set up the live view.

import PlaygroundSupport   
let view = UIView(frame: CGRect(x: 0, y: 0, width: 800, height: 600))   
PlaygroundPage.current.liveView = view 

EDIT: Complete Code - https://docs.google.com/document/d/18zIHo10fb5PuYpmrSVnqa2480PgGrBvtiexgugw8fms/edit?usp=sharing

Upvotes: 0

Views: 1230

Answers (0)

Related Questions