An Autopsy of SKEmitterNode (With a Conversion to SwiftUI)

<p>The most downloaded apps are games, most of which have an element that could be described as an explosion; an animation to denote success, failure or even perhaps celebration. Explosions are crafted mainly using&nbsp;<code>EmitterNodes</code>, available in SpriteKit, SceneKit and the&nbsp;<code>CAAnimation</code>&nbsp;framework.</p> <p>Nodes that the Apple documentation tells us can be created within a special Xcode editor or in code itself, the preferred method the former. Apple encourages you to adopt this stance by including very little documentation on how to do so in code. This means that they make sense to the business community who like to have results as quickly as possible, but is a lot less fun for hardcore coders like us.</p> <p>Join me in this article to bridge that gap by exploring how to build emitter nodes using code; the road less trodden. A route that will help you better understand how these beasts work &mdash; and indeed give us a basis on which we can try and build a SwiftUI version from scratch.</p> <h2>Base Code</h2> <p>To kick off, I use the code I developed for&nbsp;<a href="https://medium.com/better-programming/exploring-physics-with-spritekit-and-swiftui-38c728f1adc8" rel="noopener">this project</a>. I plan to run SpriteKit from within a SwiftUI window.</p> <p><a href="https://betterprogramming.pub/an-autopsy-of-skemitternode-with-a-conversion-to-swiftui-d8c4620b4d87"><strong>Website</strong></a></p>