Value of type 'SCNView' has no member 'present'

Hello, I’m trying to follow Chapter 19 transitions, and when I am getting the follow compiling error. I’ve tried checking apple documentation and tried the method presentScene but got the same error. Anyone know whats going on?

func setupView() {
    //scnView = self.view as! SCNView
    scnView = SCNView(frame: self.view.frame)
    self.view.addSubview(scnView)
    scnView.showsStatistics = true
    scnView.allowsCameraControl = false
    scnView.autoenablesDefaultLighting = true
    scnView.isPlaying = true
    
    scnView.present(scnScene, with: transition, incomingPointOfView: nil, completionHandler: {
        self.game.state = .playing
        self.setupSounds()
        self.gameScene.isPaused = false
    })
}

@manamatan The above code should work just fine. Please check out the chapter’s sample project when you get a chance and let me know if you still have issues. Thank you! :]

The chapter’s sample project works, but when I try to follow this in my own project I got the error. Do you have any idea what is going on? Here is a screen shot of the compiler error.

@chrislanguage Can you please help with this when you get a chance? Thank you - much appreciated! :]

Hi there, be sure to import SpriteKit to solve this issue.

1 Like

Thank you! It worked, so I am guessing the problem was the SKTransition, not necessarily the present function.

This topic was automatically closed after 166 days. New replies are no longer allowed.