Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Xcode 6 Beta / Swift - Playground not updating

I was playing around with the Playground feature of Xcode 6's first beta - and I notice half the time the Playground doesn't update (simply doesn't display the result calculation or how many loop iterations are happening) simple code/loops/functions that are in there. Even the Swift Tour https://developer.apple.com/library/content/documentation/Swift/Conceptual/Swift_Programming_Language/GuidedTour.html

has several lines of code that don't show up in Playground. If you mess with the code sometimes it will show up, by moving the code around or placing it elsewhere. Anyone else? Any fixes? Is this just a beta problem?

like image 210
harveytech Avatar asked Jun 08 '14 19:06

harveytech


People also ask

How long does it take to complete Swift Playgrounds?

Swift Fundamentals – Pluralsight As an aspiring app developer, you'll learn how Swift works with data and Swift playgrounds. You'll also adopt a protocol-oriented programming mindset as you work on developing apps on iPhone, Mac, or iPad. It takes about three to four learning hours to complete this course.

Is Swift Playgrounds 4 out yet?

Swift Playgrounds 4 now available.

Does Swift playground work on Mac?

Swift Playgrounds is a revolutionary app for iPad and Mac that makes it fun to learn and experiment with Swift — a powerful programming language created by Apple and used by the pros to build today's most popular apps. Swift Playgrounds requires no coding knowledge, so it's perfect for students just starting out.

Is Swift playground worth?

There's lots to loveSwift Playgrounds is a beautiful looking environment to learn to code. It's a nice, modern, object-oriented language and I can learn concepts and conventions and put them to work later in Xcode. Children can choose step-by-step lessons and puzzles to build their coding knowledge and skills.


2 Answers

Make sure you haven't inadvertently added an error to your Playground code. Unfortunately, there is no inline notification of an error, and after an error is created, nothing in the Playground will update.

To help with this, open up the Assistant Editor (File > View > Assistant Editor > Show Assistant Editor), which should include a Console Output box. If there are any errors in your Playground, they will show up there. Once corrected, your Playground should hopefully update once more.

That said, it can be a bit slow depending on the complexity of your Playground and its size.

like image 93
rcw3 Avatar answered Oct 02 '22 00:10

rcw3


This answer (Undeclared Type 'NSView' in Playground) did it for me (restarting Xcode and the machine didn't help):

rm -rf "$(getconf DARWIN_USER_CACHE_DIR)/org.llvm.clang/ModuleCache"
like image 22
Michael Markowski Avatar answered Oct 01 '22 23:10

Michael Markowski