In-App Purchases and StoreKit in iOS 14

In-App Purchases and StoreKit in iOS 14

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.

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. Let’s go over the whole shebang to paint a complete picture just in case you’re new here.

In my eyes, the seismic change Apple made was giving you, the developer, the ability to implement in-app purchases in the simulator locally. Being able to implement in-app purchases in full without a developer account allows you to do all your testing offline. Obviously, if you want to earn any money, you’ll need to switch to the more traditional route at some point. But just getting the ball rolling is now far easier.

I’ll begin by painting a picture of what I want to build. I want to illustrate the three types of in-app purchases you can make:

  • Consumable (will last as long as you’re running the app)
  • Non-consumable (in theory, will last forever)
  • Subscriptions (renew themselves)

I want to keep things as simple as possible too, so I am going to base my app on the simple idea of an electronic ticket. You can buy a consumable ticket, a pass (a non-consumable ticket) that never expires, or a ticket subscription.

Let’s code. You need to start by creating a project. Use SwiftUI as a User interface. Once created, add two additional files to it. A simple Swift one and a template file that answers to the name StoreKit Configuration:

Image for post

Configuration file template for in-app purchases in Xcode.

Having added those two files to your project, click on the configuration file itself, which will have a plus sign through which you can add one or more of the different types of in-app purchases:

  • Consumable
  • Non-consumable
  • Auto-renewing subscription

Add one of each type and complete the details shown below:

Image for post

A consumable ticket (day pass).

programming swift ios mobile storekit

Bootstrap 5 Complete Course with Examples

Bootstrap 5 Tutorial - Bootstrap 5 Crash Course for Beginners

Nest.JS Tutorial for Beginners

Hello Vue 3: A First Look at Vue 3 and the Composition API

Building a simple Applications with Vue 3

Deno Crash Course: Explore Deno and Create a full REST API with Deno

How to Build a Real-time Chat App with Deno and WebSockets

Convert HTML to Markdown Online

HTML entity encoder decoder Online

Subscriptions, Receipts, and StoreKit in iOS 14

The gold standard of in-app purchases and subscriptions. It’s the gold standard cause it’s a regular income — it helps get over the bumps in the road. Of course, some industries have been doing this for decades, telecoms and publishing to name but two. And as such, an entire science has grown up around it. Let’s take a closer look.

Top Swift iOS App Development Company in USA

AppClues Infotech is a top Mobile App Development Company in USA building high-quality Android, iOS, and Native apps for Startups, SMBs, & Enterprises. Contact us now!

Best Swift App Development Company

Apple Swift App Development India: Mobile App Development India is an expert iOS Swift App Development company in India. We develop secure and robust mobile app solutions based on new Apple Swift language.

10 Free Online Resources To Learn Swift Language

Swift is a fast and efficient general-purpose programming language that provides real-time feedback and can be seamlessly incorporated.

iOS Mobile App Development Company in USA

AppClues Infotech is the best mobile app development company in New York that offers custom mobile app development & design services for Android and iOS.