Skip to main content

How to integrate Access on iOS?

This guide explains in detail how to install the Access SDK on iOS.

Alexandre Santini avatar
Written by Alexandre Santini
Updated over 2 months ago

The Poool Access iOS SDK allows you to integrate dynamic paywalls to control access to content in your app. It offers multiple display modes (modal, embedded, custom view) and can be easily customized via editable styles and texts. Paywall templates and the user journey are fully editable from the Poool Dashboard, without requiring an app update.

📚 You can also find our integration documentation on GitHub 👉 React Native


Installing the Poool Access iOS SDK

Poool Access can be installed in various ways depending on your dependency manager.

Installation via Swift Package Manager (SPM)

  1. Open Xcode and go to File > Add Packages...

  2. Add the following repository: https://github.com/p3ol/access-package-ios

  3. Select the desired version and add the package to your project.

  4. In your Swift files, import the framework:

import AccessIOS

Installation via CocoaPods

  1. Add the following dependency to your Podfile:

pod 'AccessIOS'
  1. Then run:

pod install

Initializing and Configuring Poool Access

Before displaying a paywall, you need to initialize the Poool Access instance with your APP_ID:

swiftCopierModifierimport AccessIOS var access = Access(key: "YOUR_POOOL_APP_ID")

You can then configure various options to tailor the user experience to your needs.

Global configuration parameters

access.config([
"subscription_url": "https://mysite.com/plans",
"login_url": "myapp://login",
"subscription_button_enabled": true,
"login_button_enabled": true,
"alternative_enabled": true,
"cookies_enabled": false,
"paywall_load_timeout": 10000
], readOnly: false)

These parameters allow you to customize the paywall display and behavior, including integrating login and subscription links, or handling user consent.


Managing Paywall Display

Bottom-sheet format (default)

access.createPaywall(pageType: "premium")

Embedded in an existing view

If you want to show the paywall directly within your interface, you can embed it in a specific view:

access.createPaywall(pageType: "premium", view: targetView, percent: 80)

The percent parameter defines how much of the targetView will be covered by the paywall.

Custom view mode

You can also insert the paywall as a manual UIView for more precise positioning:

var paywallView: UIView? = access.createPaywall(pageType: "premium")

This approach provides finer control over paywall rendering and display.


Paywall Event Handling

Poool Access emits events that allow interaction with the user journey.

Detecting content unlocking

access.onRelease { widgetEvent in
print("Content unlocked with widget \(widgetEvent.widget) named \(widgetEvent.actionName)")
}

This event is triggered when the user completes the paywall journey and gains access to the content.

Managing registration and subscriptions

access.onRegister { registerEvent in
print("User \(registerEvent.email) has registered to newsletter \(registerEvent.newsletterId)")
}

access.onSubscribeTapped { clickEvent in
print("User tapped on subscribe button \(clickEvent.button) in widget \(clickEvent.widget)")
}

These events let you capture registration or subscription actions and attach custom handling logic.


SwiftUI Integration

If your app uses SwiftUI, you can integrate the paywall directly into your views.

import AccessIOS
import SwiftUI

struct ArticleView: View {
var access: Access

init() {
self.access = Access(key: "YOUR_POOOL_APP_ID")
}

var body: some View {
VStack {
Text("first paragraph")
Text("second paragraph")
.createPaywall(access: access, pageType: "premium", percent: 80)
}
}
}

It’s also possible to generate an independent paywall view in SwiftUI:

import AccessIOS
import SwiftUI

struct ArticleView: View {
var access: Access

init() {
self.access = Access(key: "YOUR_POOOL_APP_ID")
}

var body: some View {
VStack {
Text("first paragraph")
Text("second paragraph")
access.createPaywall(pageType: "premium")
}
}
}

We hope this guide has been helpful and allows you to integrate Poool Access effectively. Feel free to contact our team via Intercom on the Poool dashboard or by email at our support address for any questions or additional assistance. We're happy to help you optimize your integration and meet your specific needs.

Did this answer your question?