Fullscreen for Swift Playgrounds on iPad

Fullscreen for Swift Playgrounds on iPad

Each ".playgroundpage" folder has a Manifest.plist file (if not, create one). Add LiveViewEdgeToEdge as a BOOL to the Manifest.plist, and set the value to YES

How Can I Make Swift Playgrounds Be Borderless on my iPad?

To locate the Manifest.plist

Step 1: Navigate to your playgroundbook from your MacBooks iCloud drive

playgroundbook's in icloud

Step 2: Rightclick and click show package contents

show package contents

Step 3: Navigate to the playgroundpage folder to find the Manifest.plist you need to change.

playgroundpage

Step 4: Edit Manifest.plist change LiveViewEdgeToEdge from NO to YES this will removes the border.

LiveViewEdgeToEdge

Step 5: To have the Live View take up the whole screen, on the Ipad select the tab between the editor and the live view and drag it, to expand the live view.

Tab Between Editor and Live View

After Dragging

Live View

IPad Playground Has Different View.Frame

Here’s how to get it to work

This is the solution I used which got it to work. In Swift Playgrounds, the layout is created in the viewDidLayoutSubview method so all frames should be created there.

Insert an image into Swift Playgrounds for iPad

You should just need to add import UIKit at the top of your playground file and then images will work.

Swift Playgrounds on iPad Not Working with SwiftUI code as Expected

I faced the same issue and I just found out that setting « Show results » to false was fixing it.

Sample Image

My iPad runs on iOS 14.6. I hope that the new Swift playgrounds with iOS 15 will fix this issue definitely.

SwiftUI on Xcode Playground vs Swift Playground - different outputs

On the iPad, you are running in Dark Mode, and that is making the default background of the view black. Also, the iPad Swift Playgrounds provides a frame in which the view runs. This frame varies if you switch between portrait and landscape mode, but in either case it is providing a frame in which to draw.

In Playgrounds in Xcode, the view is just taking up a minimum of size.

You can get a similar look in Xcode by providing a .frame and using a Color.black background:

import SwiftUI
import PlaygroundSupport

struct ContentView: View {
var body: some View {
VStack{
ZStack {
Color.white
Text("hello World")
.foregroundColor(.black)

}
.edgesIgnoringSafeArea(.vertical)
Circle()
.foregroundColor(.blue)
}
.frame(width: 500, height: 600)
.background(Color.black)
}
}

PlaygroundPage.current.setLiveView(ContentView())


Related Topics



Leave a reply



Submit