Hi, I am applying for this year's WWDC 2021 swift student challenge. I am creating a Mac Xcode Playground. I have created a start menu in Swift UI and a game in SpriteKit, I was wondering how I would go about transitioning between them when a button is clicked in the view.
Right now I am using this code to display the SwiftUI view
I was thinking I could transition like this:
I am not sure if this is a good approach. And this method does not give space for animated transitions as well. I was wondering if there is a better way to transition between these views, thank you so much in advance!
Right now I am using this code to display the SwiftUI view
Code Block swift PlaygroundPage.current.setLiveView( ContentView() .frame(width: 800, height: 750) )
I was thinking I could transition like this:
Code Block swift func goToGameScene() { let sceneView = SKView(frame: CGRect(x:0 , y:0, width: 800, height: 750)) if let scene = GameScene(fileNamed: "GameScene") { sceneView.showsNodeCount = true sceneView.showsFPS = true scene.scaleMode = .aspectFit sceneView.presentScene(scene) } PlaygroundPage.current.needsIndefiniteExecution = true PlaygroundSupport.PlaygroundPage.current.liveView = sceneView }
I am not sure if this is a good approach. And this method does not give space for animated transitions as well. I was wondering if there is a better way to transition between these views, thank you so much in advance!