Created
January 2, 2020 15:42
-
-
Save m3kwong/1a060ef5b8ea27ba4e8d063c9f58a7ae to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Get Frames Per Second log on WatchKit/WatchOS.