Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/lionheart/TipJarViewController
Easy, drop-in tip jar for iOS apps.
https://github.com/lionheart/TipJarViewController
ios swift tipping tips viewcontroller
Last synced: 6 days ago
JSON representation
Easy, drop-in tip jar for iOS apps.
- Host: GitHub
- URL: https://github.com/lionheart/TipJarViewController
- Owner: lionheart
- License: apache-2.0
- Created: 2018-05-06T17:53:59.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2024-11-29T22:09:59.000Z (12 days ago)
- Last Synced: 2024-11-29T23:18:11.388Z (12 days ago)
- Topics: ios, swift, tipping, tips, viewcontroller
- Language: Swift
- Homepage: https://code.lionheart.software/TipJarViewController
- Size: 2.29 MB
- Stars: 78
- Watchers: 6
- Forks: 13
- Open Issues: 11
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-ios - TipJarViewController - Easy, drop-in tip jar for iOS apps. (Payments / Other Parsing)
- awesome-ios-star - TipJarViewController - Easy, drop-in tip jar for iOS apps. (Payments / Other Parsing)
README
![](meta/repo-banner.png)
[![](meta/repo-banner-bottom.png)][lionheart-url][![Version][version-badge]][cocoapods-repo-url]
[![License][license-badge]][cocoapods-repo-url]
[![Platform][platform-badge]][cocoapods-repo-url]![](screenshot.jpeg)
## Installation
TipJarViewController is available through [CocoaPods](https://cocoapods.org). To install
it, simply add the following line to your Podfile:```ruby
pod 'TipJarViewController'
```### Usage
Before you can use TipJarViewController in your app, you'll first need to create a few IAPs in iTunes Connect--2 subscription IAPs and 5 one-time IAPs. This is currently a requirement but may change in the future.
Once you've created your IAPs, you just need to configure the header and description at the top of the view controller, and tell TipJarViewController what your IAP product identifiers are, using the `TipJarConfiguration` protocol. E.g.,
```swift
struct TipJarOptions: TipJarConfiguration {
static var topHeader = "Hi There"static var topDescription = """
If you've been enjoying this app and would like to show your support, please consider a tip. They go such a long way, and every little bit helps. Thanks! :)
"""static func subscriptionProductIdentifier(for row: SubscriptionRow) -> String {
switch row {
case .monthly: return "com.acme.app.TipJarSubscription.Monthly"
case .yearly: return "com.acme.app.TipJarSubscription.Yearly"
}
}static func oneTimeProductIdentifier(for row: OneTimeRow) -> String {
switch row {
case .small: return "com.acme.app.Tip.Small"
case .medium: return "com.acme.app.Tip.Medium"
case .large: return "com.acme.app.Tip.Large"
case .huge: return "com.acme.app.Tip.Huge"
case .massive: return "com.acme.app.Tip.Massive"
}
}static var termsOfUseURLString = "https://acme.app/terms.html"
static var privacyPolicyURLString = "https://acme.app/privacy.html"
}
```And then, to instantiate the `TipJarViewController`:
```swift
let controller = TipJarViewController()
```If you want more customization options, just make your configuration conform to `TipJarOptionalConfiguration`. You can also specify a URL running Lionheart's [receipt verifier](https://github.com/lionheart/in_app_purchase_receipt_verifier) to check for valid purchases on your own server.
```swift
extension TipJarOptions: TipJarOptionalConfiguration {
static var title = "Tip Jar"
static var oneTimeTipsTitle = "One-Time Tips"
static var subscriptionTipsTitle = "Ongoing Tips ❤️"
static var receiptVerifierURLString = "https://receipt-verifier.herokuapp.com/verify"
}
```## License
TipJarViewController is available under the Apache 2.0 license. See the [LICENSE](LICENSE) file for more info.
[ci-badge]: https://img.shields.io/travis/lionheart/TipJarViewController.svg?style=flat
[version-badge]: https://img.shields.io/cocoapods/v/TipJarViewController.svg?style=flat
[license-badge]: https://img.shields.io/cocoapods/l/TipJarViewController.svg?style=flat
[platform-badge]: https://img.shields.io/cocoapods/p/TipJarViewController.svg?style=flat
[downloads-badge]: https://img.shields.io/cocoapods/dt/TipJarViewController.svg?style=flat
[downloads-monthly-badge]: https://img.shields.io/cocoapods/dm/TipJarViewController.svg?style=flat[semver-url]: http://www.semver.org
[travis-repo-url]: https://travis-ci.org/lionheart/TipJarViewController
[cocoapods-url]: http://cocoapods.org
[cocoapods-repo-url]: http://cocoapods.org/pods/TipJarViewController
[doc-url]: https://code.lionheart.software/TipJarViewController/
[lionheart-url]: https://lionheartsw.com/