Swift (iOS)
Installation
To integrate ConnectFramework
into your Swift project, add the SDK via Swift Package Manager (SPM) or manually include it in your project.
Swift Package Manager
In Xcode, go to File > Add Packages.
Enter the package repository URL for
ConnectFramework
.Select a version or branch and press Add Package.
Then, import the framework where needed:
Usage
Initializing the SDK
Before making any API calls, initialize the SDK with your API key.
User Authentication
Logging in with a Unique ID
Logs the user in with a unique ID. You can pass nil
, and a unique ID will be created automatically.
Logging Out
Logs the user out entirely.
Checking if User is Connected
Returns true
if the user is logged in and running the Connect.ai desktop client.
Paywall Management
Creating a Paywall
Creates and presents a new paywall. The callback receives two parameters:
success
(Bool
):true
if the user completed a purchase,false
otherwise.productId
(String?
): The product ID if a purchase occurred, otherwisenil
.
Setting Extra JSON Data
Optional: Configures the user JSON settings used by the paywall.
Checking if User has Purchased
Returns true
if the user has already made a purchase. You should not present a paywall if this returns true
.
Analytics Tracking
Logging an Event
Logs an analytics event with a category and action.
Logging an Event with Additional Data
Logs an analytics event with a category, action, label, and numerical value.
Last updated