How to resize the Xcode playground simulator when using live viewing?

I created Swift Playground on my iPad and did all my graphical positioning on the iPad simulator. Does anyone know how to edit the size of the Xcode playground simulator? Thanks in advance.

+8
source share
2 answers

To change the size of the LiveView game board, set the preferred Content for the viewController object.

import PlaygroundSupport
import UIKit

let viewController = UIViewController()
viewController.preferredContentSize = CGSize(width: 600, height: 600)
PlaygroundPage.current.liveView = viewController
+8
source
let vc = ViewController()
vc.view.frame.size = CGSize(width: 375, height: 667)
PlaygroundPage.current.liveView = vc.view
+1
source

Source: https://habr.com/ru/post/1673793/


All Articles