Skip to content

Swift package that lets you have a tip jar running in minutes

Notifications You must be signed in to change notification settings

dkasaj/SwiftTipJar

Repository files navigation

SwiftTipJar

On Apple patforms, tip jars are a concept of letting users make in-app purchases to show appreciation for the app/developer, which don't actually unlock any additional features of the app.

This package lets you have a tip jar running in minutes.

Here are SwiftUI sample code and UIKit sample code that demonstrate this.

All you need to do is polish your UI and configure Consumable IAPs in App Store Connect or an Xcode StoreKit Configuration
(see Setting up StoreKit testing in Xcode).

Installation

SwiftTipJar is available through Swift Package Manager.

  • In Xcode, click File > Add Packages...
  • Select GitHub under Source Control Accounts
  • Search for SwiftTipJar
  • Click "Add Package" in bottom right

Usage

For a quick start refer to SwiftUI sample code and UIKit sample code.

Backstory

There are many - good - tutorials for implementing IAPs in Swift.

Following any of them will help you understand how StoreKit works, what are products request and products response, what makes up StoreKit products, how to initiate a purchase, how to observe the transaction queue, how to process a transaction...

I had to re-learn all that when I recently developed a tip jar for Tubist, a macOS menu bar YouTube player even though I've dealt with IAPs like less than two years ago. Memory fades!

Then it hit me - pretty much all tip jars work the same way, right? While learning how StoreKit works is useful and ahem noble, if all you need is a working tip jar, why not reach for a single package that already does all the lifting?

Thus I created SwiftTipJar. Use it, and hopefully get some tips out of it!

P.S. If you find any code smells or documentation smells, feel free to open an issue

About

Swift package that lets you have a tip jar running in minutes

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages