SegmentBridge
interface SegmentBridge
Bridge to Segment's analytics-swift SDK, implemented in Swift by the app.
analytics-swift exposes a pure-Swift API that is not visible to Kotlin/Native interop, so the app adds the SDK via SwiftPM and injects an adapter implementing this interface. A ready-made adapter is published as the autograph-segment-swift Swift package, making the wiring a single line.
JSON payloads cross the bridge as strings; the Swift adapter decodes them, applies messageId to the event's messageId, and merges the instrumentation object into context.instrumentation via an enrichment closure.