Playgrounds unresponsive/slow/unhelpful

Is it just me or Playground on Mac is super slow and unresponsive (keeps running forever, and deleting the Derived Data folder doesn't help)? Also, on both Mac and iPad Playgrounds it is super fragile. Even though the code works fine, it returns an error: "There was a problem encountered while running this playground. Check your code for mistakes", which is totally unhelpful.


It seems like a Playground Page live view can handle only a certain number of views.


Playgrounds can sometimes be incredibly stressful to work with for me, and sometimes just plain slow. I would love to hear your experiences and if this has ever happened to you!

Accepted Reply

Hey everyone, thank you all for your tips!


I have found that these two tricks have helped me tremedously:


  • iCloud Drive Sync: write code on your Mac and run it on your iPad (writing code is a lot easier on the Mac, and the iPad Swift Playgrounds app runs it a lot faster)
  • Split up subclasses into different files in the Sources folder. This will make the playground run a lot faster!

Replies

Hey Cesare!

I'm experiencing the same problem. I'm working with ~100 image views (depends on the screen size) and it doesn't seem to cope with adding more than a small amount. As you say, it definitely limits the interactivity you can implement. It works totally fine on macOS, but fails every time of iOS.

Hey Andrew! Sorry to see you're having troubles with Playgrounds and UIImageViews. Check this out if you haven't already: http://stackoverflow.com/questions/42695165/limited-number-of-views-in-swift-playgrounds?noredirect=1#comment72567608_42695165 This guy put images into SKNodes as a workaround. Let me know if that helps!

Should one have to resort to such arcane solutions?


The question remains: Why is xcode so utterly, utterly useless?