appcraftconsulting/buymeacoffee
Buy Me a Coffee framework for iOS
Features
- [X] Apple Pay
- [X] iCloud Keychain
Requirements
CocoaPods | Swift Package Manager :---: | :---: Swift 5.0 | Swift 5.3 Xcode 11.x | Xcode 12.x
App Store Review
These are the two App Store Review Guidelines articles you have to know before using this framework:
- Apps may use in-app purchase currencies to enable customers to “tip” digital content providers in the app.
(vii) Apps may enable individual users to give a monetary gift to another individual without using in-app purchase, provided that (a) the gift is a completely optional choice by the giver, and (b) 100% of the funds go to the receiver of the gift. However, a gift that is connected to or associated at any point in time with receiving digital content or services must use in-app purchase.
Implement Buy Me a Coffee
- Import the BuyMeACoffee framework in your
UIApplicationDelegate:
import BuyMeACoffee- Configure the
BMCManagershared instance with the username you've chosen on www.buymeacoffee.com, typically in your app'sapplication:didFinishLaunchingWithOptions:method:
BMCManager.shared.configure(username: "appcraftstudio")- In the view controller, override the
viewDidLoadmethod to set the presenting view controller of theBMCManagerobject.
BMCManager.shared.presentingViewController = self
// You can also set a custom thank you message
BMCManager.shared.thankYouMessage = "Thank you for supporting 🎉 App Craft Studio !"- Add a
BMCButtonto your storyboard, XIB file, or instantiate it programmatically. To add the button to your storyboard or XIB file, add a View and set its custom class toBMCButton. - Optional: If you want to customize the button, do the following:
let configuration = BMCButton.Configuration(color: .orange, font: .cookie)
let button = BMCButton(configuration: configuration)
// or set the burtton configuration later
button.configure(with: configuration)<p align="center"> <br> <img src="https://github.com/appcraftstudio/buymeacoffee/raw/master/Images/snapshot-bmc-button.png" width="300"> </p>
(Optional) Configure In-App Purchase
Depending the legal receiver of the gift configured on Buy Me a Coffee, App Store reviewers can ask for In-App Purchase implementation. If the following In-App Purchase if configured for your application, it will be displayed as primary flow when user tap on the BMCButton.
If the framework can't retrieve In-App Purchase informations, the web flow will be used as fallback.
App Store Connect
Go to App Store Connect, search for the In-App Purchases section of your app, and then, create a new one with the following informations:
||| | --- | --- | | Type | Consumable | | Reference Name | Buy Me a Coffee | | Product ID | your.app.bundle.identifier.buymeacoffee | | Cleared for Sale | :white_check_mark: | | Price | Tier 4 | | Display Name | Buy Me a Coffee | | Description | Hey there! You can now buy me a coffee! | Promotional Image | download here | | Review Screenshot | download here | | Review Notes | Buy Me a Coffee enable customers to “tip” digital content providers in the app. |
Capabilities
- Select the current workspace in the project navigator.
- Then, select the app target in the left panel.
- Go to the Signing & Capabilities tab.
- Add the In-App Purchase capability.
<p align="center"> <img src="https://github.com/appcraftstudio/buymeacoffee/raw/master/Images/screenshot-xcode-capabilities.png" width="600"> </p>
Installation
CocoaPods
You want to add pod 'BuyMeACoffee', '~> 1.0' similar to the following to your Podfile:
target 'MyApp' do
pod 'BuyMeACoffee', '~> 1.0'
endThen run a pod install inside your terminal, or from CocoaPods.app.
Swift Package Manager
- Using Xcode 11 or above go to File > Swift Packages > Add Package Dependency
- Paste the project URL: https://github.com/appcraftstudio/buymeacoffee.git
- Click on next and select the project target
[Swift Package Manager]
<a href="https://www.producthunt.com/posts/buy-me-a-coffee-framework-for-ios?utm_source=badge-featured&utm_medium=badge&utm_souce=badge-buy-me-a-coffee-framework-for-ios" target="_blank"><img src="https://api.producthunt.com/widgets/embed-image/v1/featured.svg?post_id=233953&theme=dark" alt="Buy Me a Coffee framework for iOS - Embed Buy Me a Coffee framework in your applications | Product Hunt Embed" style="width: 250px; height: 54px;" width="250px" height="54px" /></a>
<a href="https://www.buymeacoffee.com/appcraftstudio" target="_blank"><img src="https://cdn.buymeacoffee.com/buttons/v2/default-yellow.png" alt="Buy Me A Coffee" style="height: 60px !important;width: 217px !important;" ></a>
Copyright © 2020 App Craft Studio. All rights reserved.
Package Metadata
Repository: appcraftconsulting/buymeacoffee
Homepage: https://www.buymeacoffee.com
Stars: 192
Forks: 31
Open issues: 1
Default branch: master
Primary language: swift
License: MIT
Topics: buymeacoffee, cocoapods, coffee, donation, framework, ios, spm, swift
README: README.md
Archived: yes