iOS

circle-info

Hackle iOS SDK supports iOS 13 and above.

  • Starting from Hackle iOS SDK 3.0.0, the minimum supported version has been changed to iOS 13.

  • The minimum supported version for Hackle iOS SDK 2.x is iOS 10.

Add Dependency

Hackle iOS SDK supports Swift Package Manager and CocoaPods.

arrow-up-right arrow-up-right

// ...
dependencies: [
    .package(url: "https://github.com/hackle-io/hackle-ios-sdk.git", from: "3.2.1")
],
targets: [
    .target(
        name: "YOUR_TARGET",
        dependencies: ["Hackle"]
    )
],
// ...

SDK Initialization

You must initialize HackleApp before using the SDK. An SDK Key is required to initialize HackleApp.

Initialization runs asynchronously, fetching the necessary information from the Hackle server and storing it in the SDK.

circle-exclamation

Display a splash screen instead of immediately launching the app, and initialize the SDK. After initialization, close the splash screen via callback so the user can begin interacting with the app.

Inject User on Initialization

You can initialize the SDK with user information included.

  • If no user information is provided, the user information stored in local storage is used.

  • If user information is provided, the user information stored in local storage is not used.

  • If no user is injected and there is no user information in local storage, a user with the Hackle Device ID as the device ID is used.

circle-info

User information can be freely updated after SDK initialization using the user configuration functions.

circle-exclamation

SDK Initialization Config

You can initialize the SDK with a configuration object.

Configuration Options

Option
Description
Default
Min Version

exposureEventDedupIntervalSeconds

Removes duplicate exposure events for the same A/B Test or Feature Flag result triggered consecutively by the same user.

  • Min: 1

  • Max: 86400 (24 hours)

60 (1 min)

2.7.0+

eventFlushInterval

The interval at which collected events are sent to the server.

  • Min: 1

  • Max: 60 (1 minute)

10

2.10.0+

pollingIntervalSeconds

Periodically updates configuration set in the Dashboard.

  • Min: 60 (1 minute)

-1 (no periodic update)

2.18.0+

automaticScreenTracking

Whether to enable automatic Screen Tracking

true

2.34.0+

automaticAppLifecycleTracking

Whether to enable automatic app start/stop tracking

true

2.59.0+

sessionPolicy

Configures session persistence and expiration conditions.

ALWAYS_NEW_SESSION ,

1800000

3.1.0+

optOutTracking

Whether to enable Opt-out.

false

3.1.0+

sessionTimeoutIntervalSeconds (deprecated)

Sets the session timeout duration. Use sessionPolicy instead.

1800 (30 min)

2.13.0+

* Supported even after app restart from version 2.41.0. * For versions below 2.41.0, the maximum value is: 3600 (1 hour).

Session Policy Configuration

You can configure session persistence and expiration conditions using the session policy.

Get Instance

After initialization, you can retrieve the HackleApp instance with the code below. If called before initialization, it returns nil. You must call it after initialization.

Refresh Dashboard Configuration

You can explicitly refresh the Dashboard configuration.

circle-exclamation

Last updated