Michael Austin Michael Austin - 9 months ago 43
iOS Question

Low fps swift playgrounds?

I am making a SpriteKit playground book on my mac. The code is quite long, and I do not know the capabilities of playgrounds. The fps are actually quite low (probably less than 15fps). Is this a limitation of playgrounds? If I send the playground book to my iPad Pro, will this limitation be similar? Is there a way to diagnose the low fps in playgrounds that may be due to other apps open on my computer?

EDIT:
Eric is correct, the playgrounds are much different and faster on iPad. The best solution to low fps is to move auxiliary code to the Sources folder so it only compiles once.

Answer Source

On the Mac, Xcode's "Playgrounds" are super useful for quick experiments but, due to their nature, terribly slow for "real" tasks.

If your code is more than a few pages long, and/or involves working with the UI, as you do with SpriteKit, the Playground may become really slow, sometimes even unresponsive.

"Playgrounds" are part of Xcode and run on top of the iOS simulator - that's how they display graphics and UI in the "Assitant Editor". The iOS simulator is not really known to be fast either.

On the other hand, "Swift Playgrounds" on iOS is a completely different app, even if it shares a lot with its Mac cousin.

Most importantly, it runs in iOS on the real device, with the real hardware processing, not emulation, which makes it ideal to use for SpriteKit, as Apple themselves often shows in their demos.

I would therefore say that your code should indeed run faster/better/properly on the iPad version.

Even if of course, I can't really know, since I don't know your code - you will probably be the one telling us later if using the iPad version made a difference.