Using SpriteKit Scenes in SwiftUI

Question:

Hi looking to meet others using SpriteKit Scenes in SwiftUI to make games with students.

Currently transitioning away from python to swift for students graduating from block coding and would love to share ideas with others making games in Playgrounds.

We make games in our classes like old Moon Patrol, Frogger, Trantor and such.

What are your students making?

Posted on September 21, 2022 in response to bigTanuki

There's a great app project in the Explorations book called BouncyBall. Students learn about drawing shapes, using animations, and scene physics. Not exactly SpriteKit, but a step in that direction. There's lots of other lab simulations as well in the playgrounds files, such as BoogieBot and Simulations. I like for students to look at the supporting files to see how the API was built and what changes they can make.

For more SwiftUI based content the Animating Shapes playground in Swift Playgrounds has a great walkthrough as well.

Posted on October 04, 2022 in response to NelsonT

Hi Nelson, my students are already using SpriteKit Scene with a python language wrapper via the Pythonista app in the iOS AppStore. I tried to open the link to Explorations in your text but the link may be broken as it opens a blank web page.

Thank you for the suggestions. I am aware of the introductory projects in the playgrounds app. I will probably run through these to familiarize my students with the differences between python and swift. I agree that they are very clear and explanatory.

That said, our projects are very game-like (“think Galaga or frogger”) and so running a SpriteKit Scene as a view in in SwiftUI is necessary for having an update method and access to SKActions. But perhaps trying to build in SwiftUI instead of UIKit will require a alternative approach to movement, touches and actions.

Thanks for the suggestions and response.


Posted on November 30, 2022 in response to bigTanuki

Hi bigTanuki!

It is a pleasure to read the amazing things you and your students are creating! I do a lot of coding with students in the SwiftUI space, but might be a bit rusty on SpriteKit (it's been a couple years since I've picked up SpriteKit). I would love to share some resources and knowledge, and work on a joint project with you, if you're keen?

Question: Using SpriteKit Scenes in SwiftUI

Maximum file size: 400MB

Insert a video

Insert an image

Insert an image

125: 125
220: 220

This action can’t be undone.

Error Message

Are you sure you want to continue? Your changes will not be saved.

This post contains content from YouTube.

If you choose to view this content, YouTube may collect and process certain personal data. You can view YouTube’s <a href="https://www.youtube.com/t/privacy" target="_blank">privacy policy here<span class="a11y">(opens in new window)</span>.</a>

This post contains content from YouTube.

You’ve rejected content from YouTube. Tap the button below to change your consent.