Installation
Add the package in Xcode: File > Add Package Dependencies and enter:Package.swift:
Quick start
configure completes are queued (up to 1,000) and sent once ready.
Configuration
Use a preset for one-line setup, or pass individual parameters.Tracking events
No user ID needed — the SDK tracks the current user automatically (anonymous until you callidentify).
Standard event names
The SDK provides strongly typed constants for common events:Revenue
Track purchases with typed currency codes:.usd, .eur, .gbp, .jpy, .btc, etc.) and accepts custom currency strings via Currency("XYZ").
User identity
Super properties
Register properties that get merged into everytrack, group, and revenue call:
Structured logging
Send logs alongside events through the same pipeline:service parameter defaults to "app". Convenience methods are available for all nine RFC 5424 levels: logEmergency, logAlert, logCritical, logError, logWarning, logNotice, logInfo, logDebug, and logTrace.
Sessions
Sessions are managed automatically. The SDK:- Generates a persistent device ID (stored in UserDefaults)
- Creates a new session on launch with a device context snapshot
- Tracks app background/foreground transitions
- Starts a new session if the app was backgrounded longer than
sessionTimeout(default: 30 minutes)
Privacy
defaultOptOut: true during configuration so new users start opted out.
When opted out, all tracking and logging calls silently drop. flush() and close() still work.
Lifecycle
reset() on logout to start a fresh anonymous session for the next user.
Advanced
Configuration reference
| Parameter | Default | Description |
|---|---|---|
endpoint | collect.tell.rs:50000 | TCP collector address |
batchSize | 100 | Events per batch before auto-flush |
flushInterval | 10s | Time between auto-flushes |
sessionTimeout | 30 min | Background time before new session |
defaultOptOut | false | Initial opt-out state for new users |
generateEventIds | false | Client-side event deduplication IDs |
logLevel | .info | SDK internal log verbosity |
Validation rules
| Field | Rule |
|---|---|
| API key | 32-character hex string |
| Event name | 1–256 characters |
| Log message | 1–65,536 characters |
| User ID | Non-empty |
| Group ID | Non-empty |
| Order ID | Non-empty |
| Revenue amount | Positive number |
Pre-initialization queue
Events called beforeconfigure completes are buffered (up to 1,000 items). On overflow, the oldest event is dropped. Once initialization succeeds, all queued events are replayed in order.