Swift SDK (iOS, macOS)
The IForevents Swift package for iOS, macOS, tvOS and watchOS apps
// Package.swift
.package(url: "https://github.com/innovafour/iforevents-sdks.git", from: "0.1.0")import IForevents
let analytics = Iforevents(integrations: [IForeventsAPIIntegration(projectKey: "pk_...")])
analytics.initialize()
analytics.identify("user_123", traits: ["email": "[email protected]", "plan": "pro"])
analytics.track("purchase_completed", properties: ["total": 9.99])
analytics.screen("Checkout", previousRoute: "Cart")
analytics.reset() // logoutCalls run on the SDK's serial queue and return immediately; pass a completion to observe the [IntegrationResult]. The user id and the pending queue live in UserDefaults, so unsent events survive restarts.
Adapters
Separate packages under Adapters/ in the same repository: IForeventsMixpanel (mixpanel-swift), IForeventsAmplitude (Amplitude-Swift), IForeventsFirebase (FirebaseAnalytics).
import IForeventsMixpanel
let analytics = Iforevents(integrations: [api, MixpanelIntegration(token: "...")])APIConfig
baseUrl, batchSize (20, max 500), flushInterval (10 s), timeout, maxRetries / retryDelay, requeueFailedEvents, storage / persistQueue, throwOnError, onQuotaExceeded, onError. IForeventsAPIError.kind is .auth, .quotaExceeded, .rateLimited, .transient or .other.
Source: iforevents-sdks/swift.