Why does Xcode Playground execute liveView through iPad-like Simulator?
Instead of
let viewController = ViewController()let window = UIWindow(frame: CGRect(x: 0, y: 0, width: 640, height: 600))window.rootViewController = viewControllerwindow.makeKeyAndVisible()import PlaygroundSupportPlaygroundPage.current.liveView = windowPlaygroundPage.current.needsIndefiniteExecution = true
Try this
let viewController = ViewController()viewController.preferredContentSize = CGSize(width: 640, height: 600)import PlaygroundSupportPlaygroundPage.current.liveView = viewControllerPlaygroundPage.current.needsIndefiniteExecution = true
This is how I change the size of my view controllers in Playgrounds
It might be related to the "Swift Playgrounds" app?
The app is iPad-only (You can't even find it in App Store on iPhone).