Data from SpriteKit to SwiftUI with Delegation

This reference article covers how you can build communication between your SpriteKit scene and a SwiftUI view using the Delegate pattern.

Data from SpriteKit to SwiftUI with Delegation

In the article Using SpriteKit in a SwiftUI Project, we covered how to use a SwiftUI based application to start working on a simple SpriteKit game. This foundation is enough to take our first steps, but as soon as your project starts growing you might want to take advantage of the interface elements and flexibility that SwiftUI offers to build the interfaces of your game and even the user interface of your game.

With this comes the question, how do establish communication between my SpriteKit Scenes and my SwiftUI Views? Let's have a look.

Become a free member or log in to proceed.