CocoaPods trunk is moving to be read-only. Read more on the blog, there are 6 months to go.

PYRXSynapse 0.2.0

PYRXSynapse 0.2.0

Maintained by Trieu Truong.



  • By
  • PYRX

PYRXSynapse

SPM compatible CocoaPods iOS Swift License: MIT CI

Native iOS SDK for the PYRX Synapse customer engagement platform.

Track events, identify users, register for push notifications, and respect user privacy — all from a single thread-safe actor API designed for SwiftUI and UIKit apps on iOS 14+.

Installation

Swift Package Manager

In Xcode: File → Add Package Dependencies…, then enter:

https://github.com/PYRX-Tech/pyrx-synapse-ios.git

Or add to your Package.swift:

dependencies: [
    .package(url: "https://github.com/PYRX-Tech/pyrx-synapse-ios.git", from: "1.0.0"),
],
targets: [
    .target(
        name: "YourApp",
        dependencies: [
            .product(name: "PYRXSynapse", package: "pyrx-synapse-ios"),
        ]
    ),
]

CocoaPods

Add to your Podfile:

pod 'PYRXSynapse', '~> 1.0'

Then run:

pod install

Quick Start

import PYRXSynapse

@main
struct MyApp: App {
    init() {
        Task {
            try await Pyrx.shared.initialize(
                config: PyrxConfig(
                    workspaceId: UUID(uuidString: "00000000-0000-0000-0000-000000000000")!,
                    apiKey: "psk_live_YOUR_API_KEY"
                )
            )
            try await Pyrx.shared.identify(externalId: "user_123")
            try await Pyrx.shared.track(eventName: "app_opened")
            _ = await Pyrx.shared.requestPushPermission()
        }
    }

    var body: some Scene {
        WindowGroup { ContentView() }
    }
}

The APNs device token is delivered through UIApplicationDelegate. See docs/QUICKSTART.md for the full AppDelegate adapter pattern and docs/PUSH_SETUP.md for end-to-end push provisioning.

Features

  • Identityidentify, alias, logout with anonymous-to-known merge, server-side event/device re-attribution, and Keychain-backed identifier persistence.
  • Eventstrack and screen with a durable on-disk JSONL offline queue, exponential-backoff retry on 5xx/transport failures, FIFO eviction at the configured cap (1000 default), drop-on-4xx semantics.
  • Push notifications — permission request, APNs token registration to /v1/devices, foreground presentation, background silent delivery, tap/action/dismiss telemetry, cold-start attribution, deep-link routing.
  • Privacy controls — tracking kill switch (setTrackingEnabled), GDPR cascade delete (deleteUser), App Tracking Transparency status readout.
  • DiagnosticsdebugInfo() snapshot with SDK version, queue depth, last drain timestamp, device-token fingerprint (never the full token), and configuration echo for support cases.
  • Thread safety — public surface is a Swift actor. Call from any task on any thread.

Documentation

Guide Purpose
docs/QUICKSTART.md Five-minute setup walkthrough — Xcode → SDK → identify → track → push
docs/API_REFERENCE.md Every public type and method, with usage examples
docs/PUSH_SETUP.md Apple Developer Program → APNs Auth Key → PYRX dashboard → app capability
docs/MIGRATION.md Migration notes between SDK versions
docs/RELEASING.md Release process for SDK maintainers
CHANGELOG.md Per-version release notes

Full developer portal: synapse.pyrx.tech/developers/sdks/ios.

Requirements

Tool Minimum
iOS 14.0
Swift 5.9
Xcode 15.0

Sample app

A complete SwiftUI sample app lives at Examples/SwiftUIDemo — every public SDK surface (identify, events, push, privacy, debug) is wired into a tab UI you can run on a Simulator or real device.

cd Examples/SwiftUIDemo
open SwiftUIDemo.xcodeproj

Set PYRX_WORKSPACE_ID and PYRX_API_KEY in the Xcode scheme's environment variables to point at your own workspace.

Contributing

Bug reports, feature requests, and pull requests are welcome on GitHub.

For substantial changes, open an issue first so we can align on direction. Every PR is gated on swift test, swiftlint --strict, and pod lib lint.

License

MIT