Using SpriteKit in Xcode projects, I am able to use the update function to update everything I need to in between frames.
e.g.
override func update(currentTime: CFTimeInterval) {
/* Called before each frame is rendered */
}
How can I do the same thing in Xcode Playground?
I do not think that this is a duplication of NSTimer.scheduledTimerWithTimeInterval in Swift Playground
/// UPDATE ///
I have discovered that I can add a class and therefore override the class to get the update functionality like so.
Add this code before any other code eg
//: Playground - noun: a place where people can play
import SpriteKit
import XCPlayground
class PrototypeScene: SKScene {
override func update(currentTime: CFTimeInterval) {
print( "update" );
callFunctionOutsideClass();
}
}
func callFunctionOutsideClass(){
}
The next issue is scope. How do I call a function in the body of the Playground from the update function I have overridden?
If I try to add any properties to the Class I get an error - "error: class 'PrototypeScene' has no initializers"
Thanks