Adapty SDK is an open-source framework that makes implementing in-app subscriptions for iOS fast and easy. It’s 100% open-source, native, and lightweight.
Adapty handles everything, from free trials to refunds, in a simple, developer-friendly SDK.
// Your app’s code
import Adapty
Adapty.activate("YOUR_APP_KEY")
// Make a purchase, Adapty handles the rest
Adapty.makePurchase(product: product) { [weak self] result in
switch result {
case let .success(profile):
// check access level
case let .failure(error):
// handle error
}
}
This is a demo applications for Adapty. Before running the app, you will need to configure the project.
Ask questions, participate in discussions about Adapty-related topics, become a part of our community for iOS app developers and marketers. Learn how to monetize your app, ask questions, post jobs, read industry news and analytics. Ad free.
In your AppDelegate
class:
import Adapty
And add the following to application(_:didFinishLaunchingWithOptions:):
Adapty.activate("PUBLIC_SDK_KEY", customerUserId: "YOUR_USER_ID")
The Adapty iOS SDK allows you to remotely configure the products that will be displayed in your app. This way you don't have to hardcode the products and can dynamically change offers or run A/B tests without having to release a new version of the app.
To fetch the paywall, you have to call .getPaywall()
method:
Adapty.getPaywall("YOUR_PAYWALL_ID") { result in
switch result {
case let .success(paywall):
// the requested paywall
case let .failure(error):
// handle the error
}
}
Once you have the paywall, you can query the product array that corresponds to it:
Adapty.getPaywallProducts(paywall: paywall) { result in
switch result {
case let .success(products):
// the requested products array
case let .failure(error):
// handle the error
}
}
To make the purchase, you have to call .makePurchase()
method:
let product = products.first
Adapty.makePurchase(product: product) { result in
switch result {
case let .success(profile):
// successful purchase
case let .failure(error):
// handle the error
}
}
With the Adapty iOS App SDK you don't have to hardcode product IDs to check the subscription status. You just have to verify that the user has an active access level. To do this, you have to call .getProfile()
method:
Adapty.getProfile { result in
if let profile = try? result.get(),
profile.accessLevels["premium"]?.isActive ?? false {
// grant access to premium features
}
}
Adapty creates an internal profile ID for every user. But if you have your own authentification system, you should set your own Customer User ID. You can find the users by the Customer User ID in Profiles. It can be used in the server-side API and then sent to all integrations.
Adapty SDK supports AppsFlyer, Adjust, Branch, Facebook Ads, and Apple Search Ads.
You can set optional attributes such as email, phone number, etc, to the user of your app. You can then use attributes to create user segments or just view them in CRM.
Adapty sends all subscription events to analytical services, such as Amplitude, Mixpanel, and AppMetrica.
So do we! Feel free to star the repo ⭐️⭐️⭐️ and make our developers happy!
Adapty is available under the MIT license. Click here for details.
link |
Stars: 318 |
Last commit: 2 days ago |
🎉 Adapty SDK was updated to support the new version of AdaptyUI and Paywall Builder
⚠️ Breaking Changes:
AdaptyUI.getViewConfiguration(paywall:_)
was transformed to AdaptyUI.getViewConfiguration(data:_)
and you are not supposed to use it directly. Read moreSwiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics