Group Group Group Group Group Group Group Group Group

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

#1

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
    })
}
#2

@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! :]

#3

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.

#4

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

#5

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

1 Like
#6

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

closed #7

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