How to get a StoreKit Subscription Introductory Offer period in Swift


To gather an Auto-Renewable Subscription Introductory Offer period, you must combine the value and unit properties from the product period structure.
The guide was made using our Free iOS StoreKit 2 Open Source project which is recommended for developers or business folk wishing to learn about how In-App Purchases or Subscriptions work and the code behind them.
Step One: Create the cases

In your project, create a file called StoreKitSubscriptionPeriod.swift and paste the code below.
We recommend placing this under Models/StoreKit.
Step Two: Implement the Utility

In your project, create a new file and add the code below.
We recommend that you add this to the StoreKitCoordinator in an extension file called StoreKitCoordinator+IntroductoryOffer.swift.
Looking to learn more about developing apps with StoreKit 2?
Read our comprehensive development guide linked below to learn about all the secrets behind developing In-App Purchases and Subscriptions with StoreKit 2.