Introduction & Installation

Requirements: iOS 13 or later, Swift 5.7+


1. Adding the Package to Your Project

Swift Package Manager

In Package.swift:

dependencies: [
    .package(url: "https://github.com/klp/klp-ios-sdk.git", from: "1.0.0")
]

Link the KLPSDK product to your target.

CocoaPods

pod 'KLPSDK', '~> 1.0.0'

Manual

You can add the KLPSDK source folder directly as a target in your Xcode project.


2. Initializing the SDK

Call initialize as early as possible (typically in AppDelegate or your @main App). If it fails due to security checks, the SDK will be unavailable; you should show an appropriate message to the user.

import KLPSDK

func application(
    _ application: UIApplication,
    didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
) -> Bool {
    let config = KLPConfig(
        environment: .prod,
        debugMode: false,  // true during development; false in production builds
        showDebugScreen: false    // true: shows test FAB and debug screen (test builds only)
    )

    do {
        try KLP.shared.initialize(config: config)
    } catch let error as KLPError {
        if case .securityChecksFailed(let result) = error {
            for check in result.getFailedChecks() {
                print("\(check.name): \(check.errorMessage ?? "")")
            }
        }
        print(error.localizedDescription)
    } catch {
        print(error)
    }

    return true
}

Configuration Fields (Summary)

FieldDescription
certificatePinsOptional. Pins for *.kaizenloyalty.com are bundled within the SDK; only add sha256/... pins for additional domains.
environmentSelects endpoint set (.dev, .test, .prod). Defaults to .dev when not explicitly passed.
debugModeWhen true, security checks are disabled and verbose logging is enabled — development only.
showDebugScreenWhen true, auxiliary interfaces for testing are visible — keep disabled in production builds.

Important: Endpoint defaults are managed inside the SDK and can be overridden via local file (KLPEndpointMatrix.local.swift). Trusted domains are automatically derived from the selected environment endpoints.