swift - Could not cast value of type 'SCNView' to 'SKView' -
i'm following tutorial create "tetris" game in swift xcode 7. followed every single step in tutorial, i'm getting runtime error:
could not cast value of type 'scnview' (0x106c19778) 'skview' (0x1068fcad0).
my gameviewcontroller.swift follows:
import uikit import scenekit import spritekit class gameviewcontroller: uiviewcontroller { var scene: gamescene! var swiftris:swiftris! override func viewdidload() { super.viewdidload() //configure view let skview = view as! skview skview.multipletouchenabled = false //create , configure scene scene = gamescene(size: skview.bounds.size) scene.scalemode = .aspectfill scene.tick = didtick swiftris = swiftris() swiftris.begingame() //presente scene. skview.presentscene(scene) scene.addpreviewshpaetoscene(swiftris.nextshape!){ self.swiftris.nextshape?.moveto(startingcolumn, row: startingrow) self.scene.movepreviewshape(self.swiftris.nextshape!){ let nextshapes = self.swiftris.newshape() self.scene.startticking() self.scene.addpreviewshpaetoscene(nextshapes.nextshape!) {} } } } override func prefersstatusbarhidden() -> bool { return true } func didtick(){ swiftris.fallingshape?.lowershapebyonerow() scene.redrawshape(swiftris.fallingshape!, completion: {}) } }
i search on google , here , didn`t find related scnview , skview.
thank in advance.
i did find problem code. instantiate skview view inside gameviewcontroller:
self.view = skview() let skview = view as! skview
before that, tried change class of view skview in storyboard, not possible.
i'd thank revisions.
Comments
Post a Comment