CocoaPods trunk is moving to be read-only. Read more on the blog, there are 18 months to go.

Hackle 2.49.1

Hackle 2.49.1

Maintained by hackle.



Hackle 2.49.1

  • By
  • Hackle

Hackle SDK for iOS

Install

CocoaPods

pod 'Hackle', '~> 2.21.1'

Swift Package Manager

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

Usage

Initialize

import Hackle

Hackle.initialize(sdkKey: "<YOUR_APP_SDK_KEY>") {
    // welcome Hackle SDK!
}

let hackleApp = Hackle.app()

Decide the A/B test variation

let variation = hackleApp.variation(experimentKey: 42)

if variation == "A" {
    awesomeFeature()
} else if variation == "B" {
    moreAwesomeFeature()
}

Decide the Feature

let isFeatureOn = hackleApp.isFeatureOn(featureKey: 42)

if isFeatureOn {
    moreAwesomeFeature()
} else {
    awesomeFeature()
}

Tracks the event

hackleApp.track(eventKey: "purchase")