SDK Integration

This document provides steps for integrating your iOS app with Hackle via the Hackle SDK.

SDK Integration is a must in order to use the functions provided by the Hackle SDK.

Step 1: Add Dependencies

Think of this step as importing our SDK into your codebase. To use our Hackle services add the following dependency code and import our SDK.


pod 'Hackle', '~> 2.6.0'

Swift Package Manager

// ...
dependencies: [
    .package(url: "", 
targets: [
        name: "YOUR_TARGET",
        dependencies: ["Hackle"]
// ...

Step 2: Initialize the SDK

Once you have imported the dependencies, in order to start using the Hackle SDK you must initialize the SDK. During this step, we get the information needed for SDK integration from the Hackle Server and store it in the SDK. As this operation runs asynchronously, the callback action lets you know that the initialization is complete.

Initialize the SDK by passing the SDK key and callback to the Hackle.initialize() method.

The SDK key can be found in the SDK integration in the dashboard of Hackle service.

import Hackle

// Enter the SDK Key in the YOUR_APP_SDK_KEY. 
Hackle.initialize(sdkKey: "YOUR_APP_SDK_KEY") {
    // SDK ready to use.
@import Hackle;

// Enter the SDK Key in the YOUR_APP_SDK_KEY. 
[Hackle initializeWithSdkKey:@"YOUR_APP_SDK_KEY" completion:^{
    // SDK ready to use.


SDK initialization should only occur once

The Hackle.initialize() method must only be called once.

Recommended initialization method: initialize via loading screen

Instead of starting the app immediately, display a loading screen and initialize the SDK.
The callback then closes the loading screen and allows the user to start interacting with the app.

If you're using this method, it's a good idea to put a time limit on the loading screen.

After initialization, you can obtain the HackleApp instance through the code below.

let hackleApp =
HackleApp *hackleApp = [Hackle app];