-
Notifications
You must be signed in to change notification settings - Fork 3
Conversation
This broke when SwiftLint 0.53.0 came out with a new "Unneeded Overridden Functions" rule.
12da17d
to
3b0fd67
Compare
PreviewsSee contentsDisplaying PaywallsHow to display a fullscreen Paywall in your appRevenueCat Paywalls will, by default, show paywalls fullscreen and there are multiple ways to do this with SwiftUI and UIKit.
import SwiftUI
import RevenueCat
import RevenueCatUI
struct App: View {
var body: some View {
ContentView()
.presentPaywallIfNeeded(
requiredEntitlementIdentifier: "pro",
purchaseCompleted: { customerInfo in
print("Purchase completed: \(customerInfo.entitlements)")
},
restoreCompleted: { customerInfo in
// Paywall will be dismissed automatically if "pro" is now active.
print("Purchases restored: \(customerInfo.entitlements)")
}
)
}
} import SwiftUI
import RevenueCat
import RevenueCatUI
struct App: View {
var body: some View {
ContentView()
.presentPaywallIfNeeded { customerInfo in
// Returning `true` will present the paywall
return customerInfo.entitlements.active.keys.contains("pro")
} purchaseCompleted: { customerInfo in
print("Purchase completed: \(customerInfo.entitlements)")
} restoreCompleted: {
// Paywall will be dismissed automatically if "pro" is now active.
print("Purchases restored: \(customerInfo.entitlements)")
}
}
} import SwiftUI
import RevenueCat
import RevenueCatUI
struct App: View {
@State
var displayPaywall = false
var body: some View {
ContentView()
.sheet(isPresented: self.$displayPaywall) {
PaywallView()
// PaywallView does not have a close button
// Manually add one to match your app's style
.toolbar {
ToolbarItem(placement: .destructiveAction) {
Button {
self.displayPaywall = false
} label: {
Image(systemName: "xmark")
}
}
}
}
}
} import UIKit
import RevenueCat
import RevenueCatUI
class ViewController: UIViewController {
@IBAction func presentPaywall() {
let controller = PaywallViewController()
controller.delegate = self
present(controller, animated: true, completion: nil)
}
}
extension ViewController: PaywallViewControllerDelegate {
func paywallViewController(_ controller: PaywallViewController,
didFinishPurchasingWith customerInfo: CustomerInfo) {
}
} Close ButtonPaywalls displayed with How to display a footer Paywall on your custom paywallRevenueCatUI also has a paywall variation that can be displayed as a footer below your custom paywall. This allows you to design your paywall exactly as you want with native components while still using RevenueCat UI to handle it. This is done by adding the The footer paywall mainly consists of the following:
This is all remotely configured and RevenueCatUI handles all the intro offer eligibility and purchase logic. import SwiftUI
import RevenueCat
import RevenueCatUI
struct YourPaywall: View {
var body: some View {
ScrollView {
// Your custom paywall design content
}
.paywallFooter()
}
} import SwiftUI
import RevenueCat
import RevenueCatUI
struct YourPaywall: View {
let offering: Offering
var body: some View {
ScrollView {
// Your custom paywall design content
}
.paywallFooter(offering: offering, condensed: true) { customerInfo in
// Purchase completed! Thank your user and dismiss your paywall
}
}
} CustomizationHow to use custom fontsPaywalls can be configured to use the same font as your app using a By default, a paywall will use the We also offer a If you need more control over your font preferences, you can create your own import SwiftUI
import RevenueCat
import RevenueCatUI
struct App: View {
var body: some View {
ContentView()
.presentPaywallIfNeeded(
fonts: CustomPaywallFontProvider(fontName: "Arial")
) { customerInfo in
// Returning `true` will present the paywall
return customerInfo.entitlements.active.keys.contains("pro")
}
}
} import SwiftUI
import RevenueCat
import RevenueCatUI
struct App: View {
var body: some View {
ContentView()
.presentPaywallIfNeeded(
fonts: RoundedSystemFontProvider()
) { customerInfo in
// Returning `true` will present the paywall
return customerInfo.entitlements.active.keys.contains("pro")
}
}
}
class RoundedSystemFontProvider: PaywallFontProvider {
func font(for textStyle: Font.TextStyle) -> Font {
return Font.system(textStyle, design: .rounded)
}
} Default PaywallIf you attempt to display a Paywall for an Offering that doesn't have one configured, the RevenueCatUI SDK will display a default Paywall. temp/event-types-and-fields.md See contentsRevenueCat sends webhooks in response to events that occur in your app. Here these event types are defined, as well as the data contained in each webhook. Event Types[block:parameters] Events FormatWebhook events are serialized in JSON. The body of a {
"api_version": "1.0",
"event": {
"aliases": [
"yourCustomerAliasedID",
"yourCustomerAliasedID"
],
"app_id": "yourAppID",
"app_user_id": "yourCustomerAppUserID",
"commission_percentage": 0.3,
"country_code": "US",
"currency": "USD",
"entitlement_id": "pro_cat",
"entitlement_ids": [
"pro_cat"
],
"environment": "PRODUCTION",
"event_timestamp_ms": 1591121855319,
"expiration_at_ms": 1591726653000,
"id": "UniqueIdentifierOfEvent",
"is_family_share": false,
"offer_code": "free_month",
"original_app_user_id": "OriginalAppUserID",
"original_transaction_id": "1530648507000",
"period_type": "NORMAL",
"presented_offering_id": "OfferingID",
"price": 2.49,
"price_in_purchased_currency": 2.49,
"product_id": "onemonth_no_trial",
"purchased_at_ms": 1591121853000,
"store": "APP_STORE",
"subscriber_attributes": {
"$Favorite Cat": {
"updated_at_ms": 1581121853000,
"value": "Garfield"
}
},
"takehome_percentage": 0.7,
"tax_percentage": 0.3,
"transaction_id": "170000869511114",
"type": "INITIAL_PURCHASE"
}
} Common Fields[block:parameters]
Subscription Lifecycle Events Fields[block:parameters]
Cancellation and Expiration Reasons[block:parameters] See contentsSample apps are currently included in each SDK repository and demonstrate how to integrate the SDK in your own apps. PlatformsSwiftInstallation :fa-arrow-right: | Sample App :fa-arrow-right: | App Extensions (e.g. widgets) :fa-arrow-right: SwiftUIInstallation :fa-arrow-right: | Sample App :fa-arrow-right: | Video Tutorial :fa-arrow-right: KotlinInstallation :fa-arrow-right: | Sample App :fa-arrow-right: Kotlin ComposeInstallation :fa-arrow-right: | Sample App :fa-arrow-right: JavaInstallation :fa-arrow-right: FlutterInstallation :fa-arrow-right: | Sample App :fa-arrow-right: React NativeInstallation :fa-arrow-right: | Sample App :fa-arrow-right: Capacitor/IonicInstallation :fa-arrow-right: | Sample App :fa-arrow-right: CordovaInstallation :fa-arrow-right: | Sample App :fa-arrow-right: UnityInstallation :fa-arrow-right: | Sample App :fa-arrow-right: StripeStripe Checkout Example :fa-arrow-right: FlutterFlowFlutterFlow Documentation :fa-arrow-right: | Sample App :fa-arrow-right: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I noticed [here](RevenueCat/revenuecat-docs#410) that there is a new rule, and realized that we're using an old version of SwiftLint.
This broke when SwiftLint 0.53.0 came out with a new "Unneeded Overridden Functions" rule.