- Create app for WatchOS using
Xcode 11
- Create files attached to this gist
- Folow next step and you r gucci
Add SpriteKit Scene to interface.storyboard and put check box on fullscreen
import WatchKit | |
import Foundation | |
class GameController: WKInterfaceController, WKCrownDelegate { | |
// Add SpriteKit outlet here | |
@IBOutlet weak var skInterface: WKInterfaceSKScene! | |
var gameScene:GameScene! | |
override func awake(withContext context: Any?) { | |
super.awake(withContext: context) | |
// start listening to crown | |
crownSequencer.delegate = self | |
crownSequencer.focus() | |
// Load the SKScene from 'GameScene.sks' | |
if let scene = GameScene(fileNamed: "GameScene") { | |
gameScene = scene | |
// Set the scale mode to scale to fit the window | |
scene.scaleMode = .aspectFill | |
// Present the scene | |
self.skInterface.presentScene(scene) | |
// Use a value that will maintain a consistent frame rate | |
self.skInterface.preferredFramesPerSecond = 30 | |
} | |
} | |
override func willActivate() { | |
// This method is called when watch view controller is about to be visible to user | |
super.willActivate() | |
} | |
override func didDeactivate() { | |
// This method is called when watch view controller is no longer visible | |
super.didDeactivate() | |
} | |
// @IBAction func swipedRight(_ sender: Any) { | |
// WKInterfaceController.reloadRootPageControllers( | |
// withNames: ["MainMenu"], contexts: [], orientation: .horizontal, pageIndex: 0 | |
// ) | |
// self.pushController(withName: "MainMenu", context: nil) | |
// } | |
} |
import SpriteKit | |
class GameScene: SKScene, SKPhysicsContactDelegate { | |
override func sceneDidLoad() { | |
} | |
override func update(_ currentTime: TimeInterval) { | |
// Called before each frame is rendered | |
} | |
} |
import WatchKit | |
import Foundation | |
class InterfaceController: WKInterfaceController { | |
override func awake(withContext context: Any?) { | |
super.awake(withContext: context) | |
// Configure interface objects here. | |
} | |
override func willActivate() { | |
// This method is called when watch view controller is about to be visible to user | |
super.willActivate() | |
} | |
override func didDeactivate() { | |
// This method is called when watch view controller is no longer visible | |
super.didDeactivate() | |
} | |
} |