I created a Swift Playground on my iPad and did all of my graphics positioning on the iPad simulator. Does anyone know how to edit the size of the Xcode playground simulator? Thanks in advance.
An Xcode project allows you to create real apps that you could eventually upload to the App Store (providing you became an Apple Developer). An Xcode Playground allows you to play with code and test it out.
Overview. In Swift Playgrounds, you can see live Previews of your SwiftUI views just like Previews in Xcode. In a . swiftpm project, you have a default App Preview that generates from the structure that conforms to the App protocol.
To use this new feature, start by opening up the Xcode 12 beta and create a new playground using the File > New > Playground command. Then, once you've picked your platform of choice and your playground has been created, convert it into an Xcode workspace by selecting File > Save As Workspace .
To open Playground on Xcode, navigate to File in the menu and click on New > Playground... To test our square function, we will choose the Blank template. Name your Playground file, then click on Create.
import PlaygroundSupport
import UIKit
let viewController = UIViewController()
viewController.view.frame = CGRect(x: 0, y: 0, width: 320, height: 568)
PlaygroundPage.current.liveView = viewController
Seems to me this is the only working example at the moment (Xcode 12.5).
Setting the view.frame
is the key here.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With