UPGRADE YOUR SKILLS: Learn advanced Swift and SwiftUI on Hacking with Swift+! >>

SOLVED: SOLVED: Xcode Playgrounds not showing live preview

Forums > 100 Days of SwiftUI

Hi! I'm brand new to coding, and this is the first time I have used Xcode Playgrounds. The very first video in the 100 Days of SwiftUI tutorial shows that I should be able to open a blank Playground and the live preview will start up immediately. The "Hello, Playground!" code is present, but no live preview. Instead, I am just getting a blank preview screen, and I haven't been able to figure out how to get it to show up. Any ideas?

Thank you!

3      

I assume that your playground code is something like this

import UIKit

var greeting = "Hello, playground"

In which case press the arrow in the circle icon.

At the bottom of the panel you should see two icons - a square with a thick line in it, and a blank square. Press the icon with the thick line in it, and a new area should open up beneath it.

Replace the existing code with

import SwiftUI

var greeting = "Hello, playground"
print (greeting)

And press the arrow in a circle (Run) icon again.

Where this takes you, and what you do next will be up to you.

Happy coding.

4      

Thank you, that worked! I don't need to use the print command anymore, and the live preview is showing on the right hand side.

3      

Hi! 12 months later and I'm in exactly the same boat as @zeldazeldajones. Except, I can see the Debug Area at the bottom and the Live Preview area on the right, it's just that they are blank. Sure, they update when I run the playground, but in the interests of trying to learn (and a degree of pedantry) I would really like to be able to see the live output as seen in Paul's videos.

I'd greatly appreciate any assistance anyone can please provide, thanks!

2      

BUILD THE ULTIMATE PORTFOLIO APP Most Swift tutorials help you solve one specific problem, but in my Ultimate Portfolio App series I show you how to get all the best practices into a single app: architecture, testing, performance, accessibility, localization, project organization, and so much more, all while building a SwiftUI app that works on iOS, macOS and watchOS.

Get it on Hacking with Swift+

Sponsor Hacking with Swift and reach the world's largest Swift community!

Archived topic

This topic has been closed due to inactivity, so you can't reply. Please create a new topic if you need to.

All interactions here are governed by our code of conduct.

 
Unknown user

You are not logged in

Log in or create account
 

Link copied to your pasteboard.