A look at the synergies between SwiftUI, SpriteKit and Combine

Photo by Wan San Yip on Unsplash

This is the third paper in what started as a singleton and is turning into a series. Within it I want to continue to document my journey exploring the synergies I can find when implementing a SpriteKit based game within a SwiftUI interface.

The goal of today to take what I learned in the first and second articles on this and try and build a third hybrid app. The plan to use three GameScenes, one as the display [as before], the other two as the control surfaces [this time using SpriteKit] with some additional components to try and bring it…


Integrate SpriteKit and Core Image filters into your SwiftUI app

Photo by Girl with red hat on Unsplash.

The other day, I came across a brilliant article by Artturi Jalli. It uses SpriteKit to create a background to a SwiftUI login interface. A living, moving background.

Just a few weeks earlier, I watched Apple announce that they were now supporting attributed strings in SwiftUI. This capability was documented by @Zheng.

As I mulled over these two articles, two thoughts collided. You see, I have an idea for a game that I want to develop, but it needs a stonking title. I loved Artturi’s idea of a SpriteKit background but needed something different. …


A compendium of shapes using paths

In part 1 and 2 of this series I covered isosceles polygons, equilateral triangles, right + left angles triangles, parallelograms and trapezoids; putting together routines to build them using methods based on circles. You can find the stories here. Shapes that you can mutate and animate to your hearts content in code.

At the end of part 1 I mentioned that we would return to the triangles and indeed in part 2 developed a routine that I want to take further in this article. Further to try and do some more triangles. The plan to do the sort I missed…


A compendium of shapes using paths

In part 1 of this series I covered polygons principally, putting together routines to build them using paths a couple of methods based on circles. You can find the story here. Shapes that you can mutate and animate to your hearts content in code.

We covered a lot shapes in fact in part one, but well we still got a few to think about. What’s missing. We don’t have a parallelogram or a trapezoid. Two shapes that are vary similar.

Here is an Apple text book answer for a parallelogram.

struct Parallelogram: Shape {
@State var percent: Double…


Join me on a journey to build a custom keyboard

Photo by Aryan Dhiman on Unsplash

I want to build a game that needs a keyboard. But I don’t want to use an iOS keyboard. I know there is a whole accessibility library that I can call on, but I want to do something that is a little more visually appealing. I want something that a user with fat fingers or limited sight can use. And I don’t want a keyboard that will consume half the screen either. Join me on a journey to get creative and come up with some custom keyboards.

Version I

Here is a solution that works, but is too simple. I can recall…


A exploration of SKEffectNode [and CIFilters enviably]

The worst bugs that have taken the most amount of my time haven’t been my doing, no — they’ve been in iOS itself [and others]. You know what I am talking about, its that moment you realise you lost an afternoon of development time with some code that should have worked, but didn’t. Code that matches Apple’s template, but fails to compile and/or run or even worse runs and does nothing or crash dumps.

I mention this because during my ongoing odyssey into the depths of SpriteKit I feel that I have been skirting along that thin line. In fairness…


A look at a command surely designed by a CS graduate

Spiral architecture
Spiral architecture
Photo by Nick Hillier on Unsplash.

As a Computer Science graduate, I’m beginning to realise that I see the world differently from most people. And every now and again, I come across a command so arcane that I quietly think to myself, “This was surely designed by a fellow CS graduate.”

One such command is SKWarpGeometry in SpriteKit. Even the Apple documentation page on the subject was put together by a CS graduate. I know that because it is also somewhat impenetrable. This makes for a great article on the subject.

Join me on a quest to figure out how this thing works and how to…


Game development with SpriteKit and SwiftUI

Dice
Dice
Photo by Riho Kroll on Unsplash.

I recently published an article about using SpriteKit together with SwiftUI. I am pleased to say it was well received:

Within it, I created a simple game using a matrix of SpriteKit game scenes together with some SwiftUI code to arrange them. The emphasis in the app was on controlling your SwiftUI interface with SpriteKit.

In this article, I want to do the opposite. I am going to use a single game scene, this time within a SwiftUI interface, but with the emphasis on SwiftUI controlling the SpriteKit — to an extent anyway.

The Journey

Let’s build one of those games where…


How do you measure code quality

Photo by Sebastian Mark on Unsplash

Measuring the quality of the code programmers write has never been more important in today’s industry. As we build intelligence into anything and everything, we need to make sure the code we’re developing will make sense to those following us.

But how do you measure something a nefarious as code quality? How do you judge one piece of code over another? In this article, I want to talk about some of the metrics the industry is using today and look at a couple of solutions you can implement in your own projects. Metrics that you need to run on your…


SwiftUI, SpriteKit, and the missing touch gesture

Gem glowing in the dark
Gem glowing in the dark
Photo by Michael Dziedzic on Unsplash.

SpriteKit has been around for almost ten years now, coming out at WWDC 2013, being revised in 2014, 2016, 2017, and 2019, and even being mentioned at WWDC 2020.

It is Apple’s framework for creating 2D games. It is easy to use and a very good way to teach young programmers their craft. Search all your favourite sources for documents talking about how to implement it. Most of the articles you’ll find focus either on the basics (as Felicity Johnson does in this article) or go all out (e.g. Dylan Shine put together a super-impressive guide on building a game).

Mark Lucking

Coding for 35+ years, enjoying using and learning Swift/iOS development. Writer @ Better Programming, @The StartUp, @Mac O’Clock, Level Up Coding & More

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store