I'm using Xcode 7 beta 2 and following raywenderlich.com's Breakout tutorial to learn SpriteKit. Here's the error I get when I try to load GameScene using unarchiveFromFile.
GameScene.type does not have a member named unarchiveFromFile.
Here's the code:
func didBeginContact(contact: SKPhysicsContact) {
// 1. Create local variables for two physics bodies
var firstBody: SKPhysicsBody
var secondBody: SKPhysicsBody
// 2. Assign the two physics bodies so that the one with the lower category is always stored in firstBody
if contact.bodyA.categoryBitMask < contact.bodyB.categoryBitMask {
firstBody = contact.bodyA
secondBody = contact.bodyB
} else {
firstBody = contact.bodyB
secondBody = contact.bodyA
}
// 3. react to the contact between ball and bottom
if firstBody.categoryBitMask == BallCategory && secondBody.categoryBitMask == BottomCategory {
//TODO: Replace the log statement with display of Game Over Scene
if let mainView = view {
let gameOverScene = GameOverScene.unarchiveFromFile("GameOverScene") as! GameOverScene
gameOverScene.gameWon = false
mainView.presentScene(gameOverScene)
}
}
}
class func unarchiveFromFile
is defined in a customextension SKNode
in GameViewController.swift of the sample project. Did you convert the project to "Last Swift syntax" ? – Alexio