omranK
omranK

Reputation: 101

How to center my Playgrounds Live View

I am instantiating a playground live view using the following code:

import UIKit
import PlaygroundSupport

let view = UIView()
view.frame = CGRect(x: 0, y: 0, width: 100, height: 100)
view.backgroundColor = .white


PlaygroundPage.current.liveView = view

The live view that appears is stuck to the top of the screen and I can't change it's location by changing the x and y values of the frame. How do I get the view to move/center on my screen?

Photo of how it comes out:

Xcode Live View

Upvotes: 3

Views: 353

Answers (0)

Related Questions