• Stars
    star
    409
  • Rank 105,709 (Top 3 %)
  • Language
    Swift
  • License
    MIT License
  • Created over 3 years ago
  • Updated 5 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Implementing In-App Purchases with StoreKit2 in Xcode 13 - 15 using SwiftUI, Swift 5.7 - 5.9, iOS 15 - 17 and macOS 12 - 14. Also supports tvOS and visionOS.


StoreHelper


Recent Major Changes

  • 23 June, 2023
    • Improved handling of subscription renewals and expirations that happen when the app's not running
    • See AppStoreHelper.paymentQueue(_:updatedTransactions:) and StoreHelper.handleStoreKit1Transactions(productId:date:status:transaction:)
  • 12 February, 2023
    • Made the configuration of subscription products more flexible
    • You can now either rely on a naming convention (as before) or use a "Subscriptions" section in "Products.plist"
    • See the Samples/Configuration/SampleProducts.plist file for details
    • Added unit tests to StoreHelperDemo project
  • 27 January, 2023
    • Fixed a bug related to isPurchased for consumable products. Caused a crash on macOS and iOS (thank you Abdullah Kardaş!)
  • 18 January, 2023
    • Additional logging of various activities added
  • 17 January, 2023
    • Improved support for handling extended wait times for StoreKit and App Store responses
    • Improved caching of purchasing status
    • Updates to many shared views to handle unknown purchases status
  • 10 January, 2023
    • Added support for caching of product purchase status in isPurchased(productId:) using the purchasedProductsFallback collection
    • Using purchasedProductsFallback as a cache can be turned on/off using StoreHelper.doUsePurchasedProductsFallbackCache
    • The purchasedProductsFallback property is now public private(set) rather than public
    • Added "Refresh Products" button and support for pull-to-refresh to the products list
    • UI improvements to various views and improved sharing of views between iOS and macOS
    • Minor documentation updates (StoreHelper Guide)
  • 13 December, 2022
    • Added proof-of-concept demo showing StoreHelper in a UIKit project
  • 27 November, 2022
    • Major update to the way subscriptions are handled
    • Subscription prices now show prices and renewal periods
    • Promotional and Introductory offers on subscriptions are now supported
    • The most appropriate promotional or introductory offers or standard price and renewal period are automatically displayed
    • Additions to StoreHelper.SubscriptionHelper: hasLowerValueCurrentSubscription(than:), isLapsedSubscriber(to:), allSubscriptionTransactions()
    • Added in-app redemption of offer codes
    • Added new sections to the Guide on "Subscription Introductory and Promotional Offers" and "Supporting In-App Offer Code Redemption"
    • Quick Start and Guide documentation reviewed and updated for iOS16/macOS13/Xcode14 and new subscription features
  • 7 Nov, 2022
    • Minor changes re upgrade to iOS 16 and macOS 13
  • 19 October, 2022
    • Added new section to the Guide on "Restoring Previous Purchases"
  • 15 March, 2022
    • Changed the initialization flow because of a new warning in Xcode 13.3 related to having @MainActor init()
    • Removed the need for StoreHelper's init method to run on the main thread by moving some initialization code to a new start() method
    • You should now call StoreHelper.start() as soon as possible after initializing StoreHelper
    • The start() method starts listening for transactions and get localized product info from the App Store
    • Updated all documentation because of this change
  • 25 January, 2022
    • Refactored StoreHelper as a SPM Package
    • Moved example app to separate repo (StoreHelperDemo)
    • Updated documentation re change to SPM package
  • 19 January, 2022
    • Major updates to documentation
    • Added Mac target
  • 21 December, 2021
    • Updated documentation to reflect refactoring changes
  • 20 December, 2021
    • Refactored throughout so that this non-private version of StoreHelper is in-sync with private StoreHelper code used in an app released to the App Store

Overview of StoreHelper

StoreHelper is a Swift Package Manager (SPM) package that enables developers using Xcode 14/13 to easily add in-app purchase support to iOS 16/15 and macOS 13/12 SwiftUI apps.

StoreHelper is used to provide in-app purchase support in Writerly (iOS/macOS), which is available on the App Store.

StoreHelper provides the following features:

  • Multi-platform (iOS, macOS) SwiftUI support for purchasing Consumable, Non-consumable and Subscription products
  • Detailed documentation and an example project
  • Supports transaction validation, pending ("ask to buy") transactions, cancelled and failed transactions
  • Supports customer refunds and management of subscriptions
  • Supports introdctory offers, in-app redeeming of offer codes and experimental support for promotional offers
  • Provides detailed transaction information and history for non-consumables and subscriptions
  • Support for direct App Store purchases of promoted in-app purchases

License

MIT license, copyright (c) 2022, 2023 Russell Archer. This software is provided "as-is" without warranty and may be freely used, copied, modified and redistributed, including as part of commercial software.

See License for details.

Requirements

StoreHelper uses Apple's StoreKit2, which requires iOS 16/15, macOS 13/12 and Xcode 14/13.

Getting Started

Jump to the Quick Start guide.

More Repositories

1

IAPHelper

In-App Purchase Helper, including support for on-device receipt validation in Xcode 12, Swift 5 and iOS 14.
Swift
35
star
2

StoreHelperDemo

Implementing and testing in-app purchases with StoreKit2 and StoreHelper in Xcode 14 with SwiftUI, Swift 5.7, iOS 16 and macOS 13.
Swift
24
star
3

IAPDemo

Implementing and testing In-App Purchases in Xcode 12 and iOS 14, including local receipt validation.
Swift
23
star
4

SwiftUI-SplitViewNavDemo

Demonstrating the use of a Sidebar, SplitView and Navigation styles in a multiplatform app.
Swift
15
star
5

RCFlowers4U

Using RevenueCat to implement in-app purchases in Xcode 13, Swift 5.5, SwiftUI, iOS 15 and macOS 12.
Swift
13
star
6

ModalStylesDemo

Exploring the differences between presentViewController and pushViewController with new iOS 13 modal presentation styles.
Swift
13
star
7

MyFilesExplorer

SwiftUI app that uses the Dropbox API to enable browsing of folders and files. Runs on iOS and macOS clients.
Swift
10
star
8

SpeechDictationDemo

An iOS speech recognition demo that transcribes live speech
Swift
8
star
9

SwiftUI-ImageAPIDemo

Using SwiftUI to consume REST API with image data.
Swift
6
star
10

StoreHelperDemoUIKit

Experimental demo showing StoreHelper in a UIKit project
Swift
6
star
11

HelloIAPWorld

Minimal In-App Purchase example for iOS 14 and Xcode 12
Swift
6
star
12

SwiftUI-Combine-NotificationDemo

Using SwiftUI and Combine extensions to NotificationCenter
Swift
5
star
13

FaceIDSwiftUI

Using Biometric FaceID or TouchID to authenticate a user on iOS 15
Swift
5
star
14

PicSearch

Demo of Siri shortcuts for iOS 12 using NSUserActivity
Swift
3
star
15

SwiftUI-SwiftUIHostingUIKit

How to use UIKit UIView and UIViewController in SwiftUI
Swift
2
star
16

SwiftUI-AlertDemo

Using SwiftUI to display alerts, actionsheets and popovers
Swift
2
star
17

CalDemo

Demo for getting events from iOS calendars
Swift
2
star
18

EU-DSA-AppStore

Additional App Store Compliance Info for the EU Digital Services Act
2
star
19

StoreKitHelper

StoreKitHelper for StoreKit2 and iOS 18
Swift
2
star
20

MyGitHub

SwiftUI app that uses OAuth2 to authenticate a user and allow viewing of the user's repos and profile via the GitHub REST API
Swift
2
star
21

SwiftUI-ListDemo

Creating an editable list with SwiftUI with support for navigation
Swift
1
star
22

RoundUp

Windows Phone Geo Location App (Archived from Microsoft TFS)
C#
1
star
23

DarkModeDemo-UIKit

Updating an existing App Store app for iOS 13 Dark Mode
Swift
1
star
24

PixabayCollections

Programmatic UICollectionView with Diffable Data Source
Swift
1
star
25

SwiftUI-KeyboardOverlapDemo

Adding support for avoiding the on-screen keyboard hiding important UI.
Swift
1
star
26

ShowRandomColor

Demo of Siri shortcuts for iOS 12 using Intents
Swift
1
star
27

SwiftUIAPOD

A simple SwiftUI NASA Astronomy Picture of the Day app.
Swift
1
star
28

SwiftUI-Combine-TimerDemo

SwiftUI and Combine demo
Swift
1
star
29

ImageApiAlamofire

Using Alamofire to make HTTP GET requests to the Pixabay REST API for image data. The Swift Package Manager is used to add Alamofire to the project
Swift
1
star
30

Placezz

Bookmark your favorite places
Swift
1
star
31

SwiftUINavDemo

SwiftUI navigation demo
Swift
1
star
32

SKHelper

SKHelper. A lightweight StoreKit helper package
Swift
1
star
33

SwiftUI-UIKitHostingSwiftUI

Using UIHostingController to display a SwiftUI View in a UIKit app
Swift
1
star