SDK

Swift SDK

Unified SDK for iOS and macOS — one package covers features, paywall, auth, and monitor.

Initialize

// Package.swift or Xcode → Add Package → https://github.com/onelo-tools/onelo-swift

import OneloSwift

// Initialize once (e.g. in your App or AppDelegate)
let onelo = Onelo(
  publishableKey: "onelo_pk_live_YOUR_KEY",
  baseURL: URL(string: "https://st.backend.onelo.tools")!
)

// Identify the user — must be called before using any module
await onelo.identify(userId)

Usage

// Features — read a flag off the resolved FeatureState
let isEnabled = onelo.features.feature("export-button").isEnabled   // → Bool
let status    = onelo.features.feature("export-button").status      // → .enabled | .greyed | .hidden | .upsell

// Gating — gate on the Features SDK (the BACKEND resolves each feature against
// the user's REAL plan, works with ANY plan names) or the session entitlement:
let f = onelo.features.feature("advanced-export")
if !f.isEnabled {
    // blocked → show f.badgeLabel; tap → onelo.openUpgrade(forPlan: f.requiredPlan ?? "")
}

Add via Xcode → Add Package Dependencies → https://github.com/onelo-tools/onelo-swift

Your publishable key

Replace onelo_pk_live_YOUR_KEY with your key from the dashboard → SDK tab.

Swift SDK — Onelo Docs