• Stars
    star
    363
  • Rank 117,374 (Top 3 %)
  • Language
    Swift
  • License
    MIT License
  • Created almost 9 years ago
  • Updated about 7 years ago

Reviews

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

Repository Details

A framework to add patronage to your apps.

Promo - Click to see larger version.

PatronKit

A framework for add a patronage area to your apps.

PatronKit uses CloudKit to record purchases, and then display tallies back to the user. It also shows the user when their patronage expires. This encourages users to donate frequently, hopefully rewarding you for your work.

Features:

  • Offer patronage purchases to your users in a pre-built UI (This UI is going to change in a near-future release.)
  • Track when a users patronage expires
  • Showing how many users already donated
  • Show how many reviews there are for the current app version. (You have to implement the UI for this by yourself, but fetching the number is built in to PatronManager)

Requirements:

PatronKit was written with Swift 2 in Xcode 7.2. You can run it on iOS 8.0 or later. If you need to support iOS 7, use the raw Swift files (and storyboard) instead of the framework.

Installation & Usage:

There are five steps to use PatronKit:

  1. Include the framework in your project
  2. Configure your project to use CloudKit
  3. Configure In-App Purchases
  4. Tell PatronKit about your In-App Purchase identifiers
  5. Present an instance of PatronageViewController

Step 1: Including PatronKit in Your Project

PatronKit is a dynamic framework, so you should drag the Xcode project into your own, and link against it. PatronKit doesn't support CocoaPods at this time. The usual disclaimers about Swift Package Manager being a work in progress apply.

PatronKit is written in Swift, so an import is all you need to access it. You can use it in both Swift and Objective-C projects.

Swift:

import PatronKit

Objective-C:

@import PatronKit;

Note: If you run into issues with XCTest, please double check that Xcode isn't compiling the PatronKit Swift files as part of your app target.

Step 2: Configuring CloudKit

To set up CloudKit, open the Capabilities tab in Xcode and enable CloudKit. PatronKit uses the default container and record zone for storing patronage data, so you should only need to flip the switch.

CloudKit

Step 3: Configuring In-App Purchases

You should create a few in-app purchase products with the "consumable" type. The identifiers should be a reverse-domain style identifier ending with a number. This number is the length of the patronage offered by the product, in months. For example, com.mosheberman.patronapp.3 offers three months of patronage.

IAPs

Step 4: Tell PatronKit about your In-App Purchases.

You do this by passing the PatronManager an NSSet with your product identifiers, like so:

Swift:

let identifiers: Set = Set(arrayLiteral: ["com.patronkit.3", "com.patronkit.6", "com.patronkit.12"])
PatronManager.sharedManager.productIdentifiers = identifiers

Objective-C:

NSSet *identifiers = [NSSet setWithArray:@[@"com.patronkit.3", @"com.patronkit.6", @"com.patronkit.12"]];
[[PatronManager sharedManager] setProductIdentifiers:identifiers;

At this point, you're all set up. PatronKit will sort the identifiers for you when it displays the products, from smallest number of months to largest. Now, we just need to show our users the patronage options.

Step 5: Showing a Patronage View Controller

PatronageViewController subclasses UITableViewController, so you can present it as you wish. (For example, present it modally, or puh it onto a UINavigationController stack. If you present it modally, you'll have to provide your own dismissal method.)

Getting App Review Counts:

Optionally, you can get the number of reviews of your app on the App Store by passing your Apple app ID to PatronManager, by setting the appID property:

Swift:

PatronManager.sharedManager.appID = "xxxxxx"

Objective-C:

PatronManager.sharedManager.appID = @"xxxxxx"

To Do:

  • Clever things to make the patron count look good
  • Show the review count somewhere

What is Patronage?

If you've read this far, you probably already want to try patronage in your app.

Patronage is a model where everything in your app is free, but users can donate and become "patrons." For a really good explanation, download Overcast, and look at Marco's reasoning.

Thanks:

Marco Arment for providing the inspiration for this framework, as well as some guidence in the initial implementation.

License:

MIT. Please feel free to let me know if you've used this in your app and how it works for you.

More Repositories

1

MBCalendarKit

An open source calendar framework for iOS, with support for customization, IBDesignable, Autolayout, and more.
Objective-C
560
star
2

Surfboard

Surfboard is a delightful onboarding framework for iOS.
Objective-C
441
star
3

MBTileParser

MBTileParser is a game engine written using pure UIKit in the days before SpriteKit.
Objective-C
291
star
4

Precalc

This repo contains some code which can graph equations in a UIView.
Swift
105
star
5

MBMenuController

MBMenuController is similar to UIActionSheet.
Objective-C
72
star
6

ios-audio-remote-control

This repo demonstrates how to control the software based audio remote control in iOS.
Objective-C
52
star
7

FilterBar

A marriage of UINavigationBar and UISegmentedControl.
Swift
34
star
8

KosherCocoa-legacy

A port of the KosherJava project from Java to Objective-C Cocoa
Objective-C
22
star
9

ScrollViewSnapshotter

A demo project showing how to correctly snapshot the contents UIScrollView and its subclasses.
Swift
18
star
10

SpeedDialApp

A speed dial app for iOS.
Objective-C
10
star
11

Fahrii

A wrapper on Safari Mobile to support userscripts
Objective-C
7
star
12

KosherCocoa

My Objective-C port of KosherJava. KosherCocoa enables you to perform sunrise-based and sunset-based calculations for Jewish prayer and calendar.
Objective-C
7
star
13

GiphyKit

A Giphy Client + Framework in Swift
Swift
4
star
14

SpiffyKit

A framework for a drop-in view controller that allows users to contact you and share your app.
Objective-C
4
star
15

CustomScrollIndicator

A quick demo project demonstrating how to customize UIScrollView's scroll indicators.
Swift
3
star
16

MinimalOverflow

A userscript that invokes a minimalist theme on StackOverflow.com
JavaScript
3
star
17

Nippon

Nippon is a classic turn-based trading game. Reinvented for iOS.
Objective-C
3
star
18

ABookOnC

I'm using this repo to brush up on my C code, working with A Book On C.
C
2
star
19

HackerSim

Simulates hacking like in a movie
C++
2
star
20

MBScrollingLabel

A drop-in replacement for UILabel that adds the ability to scroll text.
Objective-C
2
star
21

Fence

Fence is an iOS app which assists in the creation of geofences for use location-sensitive applications.
Objective-C
2
star
22

MBRecyclingScrollView

This is a barebones implementation of view recycling. It includes a UIScrollView subclass, a barebones datasource protocol, and a barebones delegate protocol. There's no demo UI at the moment, but all the files you need are in a single folder.
Objective-C
2
star
23

LevenshteinMachine

A small project to calculate Levenshtein Distance between two strings, including unit tests and samples.
Objective-C
1
star
24

StudentsFirst

A user script to make CUNY First easier to use.
JavaScript
1
star
25

Pantheon

Pantheon is a project that allows the editing of Xcode projects on the iPad.
Objective-C
1
star
26

Nippon-Swift

A rewrite of my iOS game, Nippon, in Swift.
Swift
1
star
27

my-snippets

This is a collection of code snippets for Xcode that help with implementing Appledoc.
1
star
28

html-house

An interactive house made of HTML and CSS.
1
star
29

Introspector

An app to introspect the Objective-C runtime.
Objective-C
1
star
30

Polygon

An app using Core Graphics and math used to draw polygons.
1
star
31

MBGoDavenScraper

This is a utility app for OS X to scrape some data from GoDaven.com
Objective-C
1
star
32

Hipster

Find a new release before it was cool.
Swift
1
star
33

Stolz

Stolz is a library for handling Facebook login on OS X
Objective-C
1
star
34

MosheBerman-ios

This repo contains the source code for the Moshe Berman app.
Objective-C
1
star
35

wedding-site

This is the rep for mosheberman.com/wedding
JavaScript
1
star
36

Bitachon.org

The source code for the Bitachon.org website
JavaScript
1
star
37

PolygonJS

A demo app using math and the HTML 5 canvas element to draw polygons.
1
star
38

MosheBerman.com

My iOS themed website
CSS
1
star
39

Anchor

Anchor is a proof of concept of an idea I had to use one iOS device to help debug an app on another.
Swift
1
star