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:
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
:
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:
Add one of each type and complete the details shown below:
A consumable ticket (day pass).
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.
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!
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.
Swift is a fast and efficient general-purpose programming language that provides real-time feedback and can be seamlessly incorporated.
AppClues Infotech is the best mobile app development company in New York that offers custom mobile app development & design services for Android and iOS.