Home

Awesome

<h1 align="center" style="border-bottom: none"> <b> <a href="https://adapty.io/?utm_source=github&utm_medium=referral&utm_campaign=AdaptySDK-iOS"> <img src="https://adapty-portal-media-production.s3.amazonaws.com/github/logo-adapty-new.svg"> </a> </b> <br>Easy In-App Purchases Integration to <br>Make Your iOS App Profitable </h1> <p align="center"> <a href="https://go.adapty.io/subhub-community-ios-rep"><img src="https://img.shields.io/badge/Adapty-discord-purple"></a> <a href="http://bit.ly/3qXy7cf"><img src="https://img.shields.io/cocoapods/v/Adapty.svg?style=flat"></a> <a href="https://github.com/adaptyteam/AdaptySDK-iOS/blob/master/LICENSE"><img src="https://img.shields.io/cocoapods/l/Adapty.svg?style=flat"></a> <a href="http://bit.ly/3qXy7cf2"><img src="https://img.shields.io/cocoapods/p/Adapty.svg?style=flat"></a> <a href="https://docs.adapty.io/v2.0.0/docs/ios-sdk-installation#install-via-swift-package-manager?utm_source=github&utm_medium=referral&utm_campaign=AdaptySDK-iOS"><img src="https://img.shields.io/badge/SwiftPM-compatible-orange.svg"></a> </p>

Adapty: CRM for mobile apps with subscriptions

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.

Why Adapty?

<h3 align="center" style="border-bottom: none; margin-top: -15px; margin-bottom: -15px; font-size: 150%"> <a href="https://adapty.io/schedule-demo?utm_source=github&utm_medium=referral&utm_campaign=AdaptySDK-iOS_schedule-demo">Talk to Us to Learn More</a> </h3>

Integrate IAPs Within a Few Hours Without Server Coding

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

Price Testing for In-app Purchases on iOS Without App Releases

Paywall A/B Testing on iOS

Adapty: In-app subscriptions with paywall A/B testing

Real-time Analytics for Your iOS App

Adapty: How Adapty works

Examples of Adapty-Demo apps

This is a demo applications for Adapty. Before running the app, you will need to configure the project.

1. UIKit

2. SwiftUI

Adapty: An example of the paywall is changed on the fly

Mobile App Monetization's Largest Community

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.

<a href="https://discord.gg/subscriptions-hub"><img src="https://adapty-portal-media-production.s3.amazonaws.com/github/join-discord.svg" /></a>

Getting Started

1. Installing the iOS SDK via CocoaPods or Swift Package Manager

2. Importing, configuring, and setting up the logging

In your AppDelegate class:

import Adapty

And add the following to application(_:didFinishLaunchingWithOptions:):

Adapty.activate("PUBLIC_SDK_KEY", customerUserId: "YOUR_USER_ID")

3. Fetching and displaying products for paywalls in your app

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

4. Making and restoring mobile purchases

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

5. Getting info about the user subscription status and granting access to the premium features of the app

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

6. Identifying the users of your app

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.

7. Attribution Integration

Adapty SDK supports AppsFlyer, Adjust, Branch, Facebook Ads, and Apple Search Ads.

8. Setting User Attributes

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.

9. Analytics Integration

Adapty sends all subscription events to analytical services, such as Amplitude, Mixpanel, and AppMetrica.

10. Error Handling

11. SDK Models

Contributing

Like Adapty SDK?

So do we! Feel free to star the repo ⭐️⭐️⭐️ and make our developers happy!

License

Adapty is available under the MIT license. Click here for details.