Skip to content

Instantly share code, notes, and snippets.

@m3kwong
Created January 2, 2020 15:42
Show Gist options
  • Save m3kwong/1a060ef5b8ea27ba4e8d063c9f58a7ae to your computer and use it in GitHub Desktop.
Save m3kwong/1a060ef5b8ea27ba4e8d063c9f58a7ae to your computer and use it in GitHub Desktop.
class InterfaceController: WKInterfaceController {
@IBOutlet weak var iScene: WKInterfaceSKScene!
var scene:SKScene!
var t = 0
override func awake(withContext context: Any?) {
super.awake(withContext: context)
scene = SKScene(fileNamed: "MyScene.sks")
iScene.presentScene(scene)
scene.delegate = self
Timer.scheduledTimer(withTimeInterval: 1, repeats: true) { (timerObj) in
print("fps = \(self.t)")
self.t = 0
}
}
}
extension InterfaceController: SKSceneDelegate {
func update(_ currentTime: TimeInterval, for scene: SKScene) {
t += 1
}
}
@m3kwong
Copy link
Author

m3kwong commented Jan 2, 2020

Get Frames Per Second log on WatchKit/WatchOS.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment