TipJarViewController 2.1.0

TipJarViewController 2.1.0

Dan Loewenherz 维护。



 
依赖
QuickTableView~> 4.0
SuperLayout~> 2.0
LionheartExtensions~> 5.0
 

Version License Platform

安装

TipJarViewController 通过 CocoaPods 提供。要安装它,只需将以下行添加到您的 Podfile 中

pod 'TipJarViewController'

使用

在使用 TipJarViewController 之前,您首先需要在 iTunes Connect 中创建一些 IAP—2 个订阅 IAP 和 5 个一次性 IAP。这目前是一个要求,但可能在未来会发生变化。

创建您的 IAP 之后,您只需配置视图控制器顶部的标题和描述,并使用 TipJarConfiguration 协议告诉 TipJarViewController 您的 IAP 产品标识符。例如

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"
}

然后,实例化 TipJarViewController

let controller = TipJarViewController<TipJarOptions>()

如果您想进行更多自定义,只需使配置符合 TipJarOptionalConfiguration。您还可以指定运行 Lionheart 的 收据验证器 的 URL,以检查您自己的服务器上的有效购买。

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"
}

许可证

TipJarViewController 遵循 Apache 2.0 许可证。有关更多信息,请参阅 LICENSE 文件。