A quick disclaimer: This article is based on iOS 13 and Swift 5.x. I should also mention for beginners in this domain that the StoreKit framework can only be used if you are a registered Apple developer. I put together a more recent one here.
StoreKit will not work on the simulator either. You will need a real device to test this code. Use these compiler directives to turn off the functionality if you’re testing other features at the same time:
// your simulator code
// your real device code
Onwards and upwards then. Now, in-app…
Before you read this story, note an updated version [as in code] can be found here.
Much of the buzz at WWDC2020 was given over to SwiftUI 2.0 and ARKit, so you should forgive yourself for missing a seismic change to the StoreKit framework — a change that will make your life as an app developer far easier.
If you read my article Set Up Your SwiftUI App to SupportIn-App Purchases, then you already know half the story. The second half is unchanged, but Apple has added some new rules to the first half with iOS 14. …
I was playing around with SpriteKit, and it occurred to me that it might be a good exercise to remind myself of how many different ways I could link my SwiftUI code with my SpriteKit scene/class. I don’t present these in any order, preference, or recommendation; I show them in the order that they came into my head more or less.
I am running a SpriteKit scene within a SwiftUI app, and I want to be able to control a sprite directly using a SwiftUI element, a button in this case. …
Unfortunately, SwiftUI remains a little unfinished — at least compared to its big brother UIKit. Even though it is in its third revision with iOS15, it is still missing some important views.
I feel, one of the main challenges remaining for Apple is being how to make the transition as painless as possible. Nobody wants to rewrite UI/UX code — companies certainly can’t afford to. They need a way to reuse as much of the code they already have, but without the UIKit baggage that comes with it.
Besides that, SwiftUI is a very new paradigm, tweaking some controls which…
It worked well and I thought it would be good if I gave the art of drawing a similar treatment.
I cannot say why, but something magical about watching drawings appear as if they are being drawn by an invisible hand.
It used to be something you could do easily with UIKit using
CABasicAnimation — a route not available in SwiftUI.
So, let’s explore a new road to animate drawings in your SwiftUI application.
Let me start from the very beginning — I want to draw a shape…
Here we are, less than a week away from the production release of iOS 15 and I am still hearing SwiftUI isn’t ready for production. It is sadly becoming an urban myth.
Is it true or is it that the establishment isn’t trying hard enough? To be honest, there is some truth in it.
ScrollView are both good examples of UI elements in UIKit that in the premier case don’t exist in SwiftUI or the latter that has only been partially implemented. …
I have been writing for medium for almost two years now, during which I published some one hundred and fifty plus papers, almost all technical ones about coding in Swift, the languages used to build apps on Apple devices. I do so for a few reasons.
I must confess that in my second year of a computer science degree I had the option to take a class in computer graphics.
It was 1988 at the time and well since I hadn’t faired well in the first year of CS maths classes. It was at that time an easy decision, I took a different option.
A few decades later and I am still being haunted by CS math, so perhaps it is time to bite the bullet and do some. …
Animations are without doubt the lifeblood of iOS. Easily implemented for the most part in SwiftUI. That is assuming of course you don’t want to link your animations together, which sadly doesn’t seem to be an option Apple added to the big scheme of things yet. But all is not lost, because with a bit of lateral thinking we can code our way around this shortcoming. Join me on a journey to see how to do so.
First thoughts — of course, if the timing concerned is regular, you can use timers as I talked about in this paper. …
I have over the past month or two posted half a dozen articles about building SpriteKit based games within a SwiftUI environment whilst quietly working on a game myself. As I did so I realised I hadn’t posted anything about SpriteKit’s second cousin, GameKit. A framework that sadly hasn’t made it across to SwiftUI yet. Killing two birds with one stone, I thought I would document the job as I update myself on it since I needed to refresh my understanding of the framework. Join me on a journey to do so.
GameKit is in Apple speak their social networking…