💰 InAppPurchaseKit
Restrict Premium Features
import InAppPurchaseKit

Restrict Premium Features


Don't forget to update ToS and Privacy Policy before submitting the App to the App Store if you are using In-App Purchases.

          • requirePremium.swift
          • InAppPurchaseView.swift
  • We wanted to make In App Purchases as simple as possible. If you need to make a view only accessible to users with premium, you can use

    Text("Premium Text")

    If the user is subscribed to premium, the View will just be displayed, otherwise, we show a sheet with the InAppPurchaseView(), which is essentially a paywall, that allows the user to subscribe to premium.

    App Paywall

    Execute Code only if the user has Premium Access NEW

    You can make certain code only execute if the user has premium access using one of the following functions

    public func executeIfGotPremium(otherwise consequence: NoPremiumConsequence = .showPaywall,
                                    _ closure: () -> Void)
    • otherwise - (Optional) action to perform in case the user is not signed in. .showInAppNotification or .showPaywall (Defaults to showPaywall).
    • closure - What to execute if the user has premium.

    Note: async version of this function is also available by just using await.

    Usage Example:

    func downloadVideoButtonTapped() async {
      //Premium Feature behind the paywall
      iap.executeIfGotPremium {
        // Download Video