A table view based view controller to show in app purchase items and functionality quickly within app based on SwiftStoreKit library.
Switch branches/tags
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
SimpleStore.xcworkspace ready to use Dec 16, 2017
.gitignore .gitignore updated Dec 16, 2017
SimpleStoreUI.podspec spelling mistake in alert fix Dec 17, 2017
_config.yml Update _config.yml Apr 3, 2018
preview.gif ready to use Dec 16, 2017



CocoaPods swift 4.0 CocoaPods Swift Package Manager Twitter: @mahmudahsan

A table view based view controller to show in app purchase items and functionality quickly within app based on SwiftStoreKit library. I created this UI based library so that in all my apps I can quickly integrate in app purchase store.

SwiftStoreKit did the heavy tasks based on StoreKit APIs. My UI based library just use some of those functions and a quick and simple UI to integrate faster.



  • List in app purchase items within app in table style
  • Each item has image, title and price
  • Currently the UI only supports non-consumable item.
  • Based on SwiftStoreKit library

Example How to implement

Step 1: Add the following code in AppDelegate.swift

let iAP_RemoveAd = "net.yourcompany.product"

func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
        return true
  func loadStore(){
    StoreManager.shared.storeItems = [
        Product(name: "Restore", productId: StoreManager.RestoreAll, price: "", purchased: false, image: "iap_restore"),
        Product(name: "Remove Ads", productId: iAP_RemoveAd, price: "", purchased: false, image: "iap_remove_ads"),
  • In this example we define only one in app purchase item named iAP_RemoveAd. If you have many in app purchase items, you can define all here or some where else.
  • Fill StoreManager.shared.storeItems with your in app purchase items. If you don't want to show Restore feature, you can remove the first line. Also you may or may not fill the price argument as it will auto fill later by the Store Manager.
  • purchased: false is the default value. When the store load, StoreManager will check and updated price and purchased fields.

Step 2: In your main view controller write the following codes

import UIKit
import MBProgressHUD
import SimpleStoreUI

extension UIViewController {
    //MARK: - Top View Controller
    static func topViewController()-> UIViewController{
        var topViewController:UIViewController = UIApplication.shared.keyWindow!.rootViewController!
        while ((topViewController.presentedViewController) != nil) {
            topViewController = topViewController.presentedViewController!;
        return topViewController

class ViewController: UIViewController {
    @IBAction func showStore(_ sender: Any) {
    //Main code to add the Store UI within app
        let bundle  = Bundle(for: StoreViewController.self)
        let storeVC = StoreViewController(nibName: "StoreViewController", bundle: bundle)
        StoreManager.shared.storeManagerDelegate = self
        storeVC.title     = "Store"
        self.navigationController?.pushViewController(storeVC, animated: true)

extension ViewController : StoreManagerDelegate {
    //MARK:- HudDelegate
    public func showHud() {
        print("Show HUD")
        MBProgressHUD.showAdded(to: UIViewController.topViewController().view, animated: true)
    public func hideHud() {
        MBProgressHUD.hide(for: UIViewController.topViewController().view, animated: true)
    public func purchaseSuccess(productId: String) {
        if productId == iAP_RemoveAd {
            // TODO: DO SOMETHING
            print("Remove Ads Purchase Success. Do Something!")
  • showStore() function demonstrate how to show the UI.
  • StoreManagerDelegate has 3 functions. You can modify all of this
  • purchaseSuccess() with productId will be called every time user purchase any non-consumable item or restore any of them. It's your job to define how to give the feature to your user based on productId.

Step 3: To know whether user purchase any item or not use the following function


Usage in an iOS application


  • Drag the folders SimpleStore/Sources folder into your application's Xcode project.


  • Use CocoaPods or the Swift Package manager to include SimpleStore as a dependency in your project.
pod 'SimpleStoreUI'


pod 'SimpleStoreUI', :git => 'https://github.com/mahmudahsan/SimpleStoreUI'
  • In your project add the icons of your in app purchase items. Better use StoreIcons.assets to add icons. You will find this StoreIcons.assets in the demo folder

Questions or feedback?

Feel free to open an issue, or find me @mahmudahsan on Twitter.