iOS SDK
Install and use the native Swift SDK for calls, livestreams, messaging, CallKit and push.
Swift Package Manager, from the public mirror of sdks/ios (SwiftPM needs Package.swift at a repository root; see package publishing). Not yet released.
.package(url: "https://github.com/guildsman/lynkoria-swift.git", from: "0.1.0")
// targets: "Lynkoria" (media, CallKit, PushKit) or "LynkoriaCore" (messaging only)Requirements: iOS 15+, macOS 12+, Swift 5.9 tools. Lynkoria depends on LiveKit Swift 2.19.0+. LynkoriaCore uses Foundation only and also builds on Linux.
Messaging
let client = LynkoriaClient(baseURL: URL(string: "https://api.lynkoria.com")!) {
TokenResult(token: try await backend.lynkoriaMessagingToken()) // never a service key
}
await client.connect()
_ = try await client.history(conversationId) // also starts gap tracking
for await event in client.messageEvents() { render(event) }
_ = try await client.send(conversationId, text: "Hello")Streams: stateChanges(), messageEvents(), presenceEvents(), typingEvents(), readEvents(), callSignals(), errors(). Disconnect when the app backgrounds; reconnecting replays missed events.
Calls and livestreams
let call = try await LynkoriaCall.join(try await backend.joinCall(callId)) // JoinCredentials
try await call.setMicrophoneEnabled(true)
try await call.setCameraEnabled(true)
// SwiftUI: observe call.state / call.participants; render with LiveKit's SwiftUIVideoView(track)
await call.leave()Info.plist: NSMicrophoneUsageDescription, NSCameraUsageDescription; background modes audio and voip for calls.
Screen share: setScreenShareEnabled(true) shares the app. System-wide sharing needs a Broadcast Upload Extension using LiveKit's ReplayKit sample handler and an App Group; follow LiveKit's iOS screen-share guide.
Push, PushKit and CallKit
let callKit = LynkoriaCallKit(appName: "VibeLynk") { voipToken in
Task { try await client.registerPushToken(provider: "apns_voip", token: voipToken, appId: bundleId, apnsEnvironment: "production") }
}
callKit.delegate = self // join on answer, tell your backend on decline/end
// AppDelegate:
func application(_ app: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken token: Data) {
Task { try await client.registerPushToken(provider: "apns", token: apnsTokenString(token), appId: bundleId, apnsEnvironment: "production") }
}
func application(_ app: UIApplication, didReceiveRemoteNotification info: [AnyHashable: Any]) async -> UIBackgroundFetchResult {
callKit.handleRemoteNotification(info) ? .newData : .noData
}CallKit owns audio session activation for calls it reports: on answer the SDK keeps LiveKit's audio engine off until CallKit calls provider(_:didActivate:), which avoids answered calls with no audio. Add the audio and voip background modes to keep calls running in the background.
Lynkoria sends VoIP pushes only for incoming calls, and every one is reported to CallKit immediately, as Apple requires. Cancellations and messages use the regular APNs token, so the app is never penalized for an unreported VoIP push. Use apnsEnvironment: "sandbox" for development builds.
Verification
The package uses Swift 6 language mode (strict concurrency). LynkoriaCore unit tests pass and a REST integration test (idempotent send, gap recovery, non-member denial) passes against a real API on Linux in CI (scripts/native-integration.sh). The realtime test is skipped on Linux because the Linux swift image's libcurl lacks WebSocket support; it must run on macOS or iOS. The full package, including the Lynkoria target and LiveKit Swift, builds for macOS with swift build. The iOS-only CallKit/PushKit code and the SwiftUI example still need an Xcode iOS build. No device tests have run.