Fix low FPS in Swift Playground

My SpriteKit playground book averaged 15 FPS on my MacBook Pro.

Are playgrounds slower than simulating iOS devices? If I run the same book on my iPad Pro, will the FPS limit be similar? Will other applications open on my computer limit the speed of playgrounds?

EDIT: Moving code, such as subclasses and extensions, to the helper code in the Sources folder in the playground book allows the simulation to run faster because the code only compiles once.

+4
source share
1 answer

On Mac Xcode, "Playgrounds" are very useful for quick experiments, but, by their nature, are terribly slow for "real" tasks.

If your code is longer than a few pages and / or includes working with a user interface, like with SpriteKit, the playground can become very slow and sometimes even not respond to requests.

"Playgrounds" are part of Xcode and work on top of the iOS simulator - how they display the graphics and user interface in the "Assitant Editor". The iOS simulator is also not known to be fast.

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

, iOS , , , SpriteKit, Apple .

, // iPad.

, , , - , , , iPad .

+5

Source: https://habr.com/ru/post/1671902/


All Articles