0

All I'm wanting is an update method with a time delta from the previous frame, but every example I'm finding is either for Swift on iOS, or with Objective-C for OSX, or uses NSTimer which is not recommended because it doesn't sync with the display refresh.

Does SpriteKit on OSX provide a simple way to just get an update method once per frame in pure swift code? A way to do it without SpriteKit would be even better.

Nic Foster
  • 2,864
  • 1
  • 27
  • 45
  • An example that uses "Objective-C for OSX" probably is easily convertible to Swift. – Alex Wayne Jan 16 '16 at 07:07
  • The use of pointers in Swift requires 'unsafe' wrapping and is pretty verbose. I'm also looking for a pure swift version if possible. – Nic Foster Jan 16 '16 at 07:10
  • To answer your last part, yes SpriteKit works the same way it does on iOS, which has an update loop call. The other option is a GCD timer (http://www.fieryrobot.com/blog/2010/07/10/a-watchdog-timer-in-gcd/) or hacking together the CVDisplayLink (http://stackoverflow.com/questions/25981553/cvdisplaylink-with-swift) option. – Lucas Derraugh Jan 16 '16 at 07:40

0 Answers0