Swiftpack.co -  Package - appbooster/appbooster-sdk-ios
Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
appbooster/appbooster-sdk-ios
Mobile A/B-testing SDK
.package(url: "https://github.com/appbooster/appbooster-sdk-ios.git", from: "0.2.5")

appbooster-sdk-ios

Mobile framework for Appbooster platform.

Installation

CocoaPods:

pod 'AppboosterSDK'

Swift Package Manager:

  1. Select File > Swift Packages > Add Package Dependency. Enter https://github.com/appbooster/appbooster-sdk-ios.git in the "Enter Package Repository URL" dialog.
  2. In the next page, specify the version resolving rule as "Up to Next Major" with "0.1.0" as its earliest version.
  3. After Xcode checking out the source and resolving the version, you can choose the "AppboosterSDK" library and add it to your app target.

Manual:

Download ZIP and copy folder AppboosterSDK to your app.

Usage

import AppboosterSDK

Initialization:

let ab = AppboosterSDK(sdkToken: "<YOUR_SDK_TOKEN>",
                       appId: "<YOUR_APP_ID>",
                       deviceId: "<YOUR_DEVICE_ID>", // optional, UUID generated by default
                       appsFlyerId: AppsFlyerTracker.shared().getAppsFlyerUID(), // optional, if AppsFlyer integration is needed (import AppsFlyerLib before)
                       amplitudeUserId: Amplitude.instance().userId, // optional, if Amplitude integration is needed (import Amplitude before)
                       usingShake: false, // true by default for debug mode, turn it off if you are already using shake motion in your app for other purposes
                       defaults: [
                         "<TEST_1_KEY>": "<TEST_1_DEFAULT_VALUE>",
                         "<TEST_2_KEY>": "<TEST_2_DEFAULT_VALUE>"
                       ])

How to fetch known tests values that associated with your device?

ab.fetch(completion: { error in })

How to get the value for a specific test?

let value: String? = ab["<TEST_KEY>"]

or

let value: String? = ab.value("<TEST_KEY>")

In case of problems with no internet connection or another, the values obtained in the previous session will be used, or if they are missing, the default values specified during initialization will be used.

How to get user tests for analytics?

let experiments = ab.experiments()

// or if you need tech details
// let experiments = ab.experimentsWithDetails()

// i.e. set Amplitude user properties
Amplitude.instance().setUserProperties(experiments);

You can disable the sending of events to analytics if debug mode is turn on.

if AppboosterDebugMode.isOn {
  // hold sending events
}

How to debug?

Before debug make sure that debug-mode for your App is turned-on on settings page

ab.showDebug = true // false by default, to print all debugging info in the console
ab.log = { text in } // to define your own log handler
let duration = ab.lastOperationDuration // the duration of the last operation in seconds

In debug mode you can see all actual tests and check how the user will see each option of the test. To show the debug menu you just need to turn it on in your personal cabinet and call

AppboosterDebugMode.showMenu(from: <yourViewController>)

or you can inherit some of your UIViewController's from AppboosterShakeToDebugController and just make shake motion on your iPhone or simulator.

==================================================

You can see the example of usage in the attached project.

GitHub

link
Stars: 1
Last commit: 2 weeks ago

Release Notes

0.2.5
2 weeks ago

Changed Amplitude parameter.

Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco