> ## Knowledge Base Index
> Fetch the complete knowledge base index at: https://help.poool.fr/sitemap.xml
> Use this file to discover available pages before exploring further.
> Pure-Markdown content can be obtained by appending a '.md' suffix to the content URLs listed in the sitemap (without the trailing slash).

# How to integrate Access on iOS?

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](https://github.com/p3ol/react-native-access)

---

## 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)

[![](https://storage.crisp.chat/users/helpdesk/website/-/d/5/e/f/d5efc48b36ba0000/eb0c4029-c3fa-497c-bbb9-a8435b_1a4j0dz.png)](https://downloads.intercomcdn.com/i/o/s22rivig/1501357589/ed06ad391b06ac920b1c1976ee7b/IMG_5396.png?expires=1773333000&signature=d08e19c09b4b5a05e07a416e4d4697710252562e21fea61fa78f93d0b32ea3e9&req=dSUnF8p7moRXUPMW1HO4zTAFfQIpszK5wk0UtTK3lx5MfSo0j4P%2Fz%2B%2BHuAQQ%0AqSCsOlhWhWBs50A%2BnpA%3D%0A)

```
access.createPaywall(pageType: "premium")
```

## Embedded in an existing view

[![](https://storage.crisp.chat/users/helpdesk/website/-/7/9/6/3/796381c584c22800/fdafb89e-46f4-404d-96f2-c2e469_3r0g6.png)](https://downloads.intercomcdn.com/i/o/s22rivig/1501356693/1a38e370e731488544ad3cb017c9/IMG_5397+%281%29.png?expires=1773333000&signature=cb056245121d3bee2704de9d29615ed717a2ca8f11612173d1181c7b871214d9&req=dSUnF8p7m4dWWvMW1HO4zWaO5mmEFqHHnUIMk3t2PBNzSWfZJNCwa7m03niC%0Acc%2BYlmVFktayBqsATAo%3D%0A)

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.