Browse documentation
Swift SDK reference
The shipped hej 0.1.0 APIs, supported behavior and explicit limits.
Native presentation
This reference covers the fuller Swift source package for iOS 17+ with SwiftUI and UIKit. LobbyClient(options:) is main-actor isolated; retain one client per intended app/environment in your host coordinator. LobbyHelpRow(client:) displays current unread, LobbySupportView(client:) presents the native conversation flow, and LobbyViewController(client:) hosts those same views for UIKit. The support root owns its navigation stack. Separate Expo and Flutter source pilots support guest foreground text on their intended iOS/Android hosts; the Swift APIs below do not apply to those clients. A standalone React Native package and macOS customer UI are not provided.
let support = LobbyClient(options: LobbyOptions(
baseURL: URL(string: "https://YOUR_LOBBY_HOST")!,
configID: "YOUR_PUBLIC_CONFIGURATION_ID"
))
// SwiftUI presentation, attached to your existing host view:
.sheet(isPresented: $showHelp) {
LobbySupportView(client: support)
}
// UIKit, using that same retained client:
present(LobbyViewController(client: support), animated: true)Lifecycle, unread and visibility
setApplicationActive(_:) forwards the host’s actual foreground state after account restoration. refreshInForeground() is an explicit existing-session count-only check: no new guest, message fetch or read/display cursor update. Observe unreadCount and unreadLastUpdatedAt; nil means no authoritative count has been seen yet. isHelpVisible follows actual SDK view visibility. The host retains notification delegates and app-icon badge ownership. No background polling is installed.
Stage customer context
setMetadata(_:) accepts at most 20 string pairs, keys of 1–64 UTF-16 units and values up to 512. Empty metadata clears the map. setCustomerDetails(name:email:externalUserID:) replaces unverified labels; setReportedProviderIDs(_:) reports candidates, not trusted billing bindings. setDeviceContext(_:) supplies bounded LobbyDeviceContext values. These Bool-returning methods reject invalid input without replacing prior staged values. They do not register a guest before Help. synchronizeProfile() waits for revisioned synchronization when supported.
// Use only fields approved for support; they are labels, not entitlements.
support.setMetadata([
"support_tier": actualTierLabel,
"projects_count": String(actualProjectCount)
])
await support.synchronizeProfile()Identity and account boundaries
identify(keepingGuestConversations:assertion:) obtains a fresh challenge for your already-authenticated host backend. The callback returns its narrowly scoped assertion; never sign it inside the app or embed a secret there. Linking is a separate explicit choice using the current guest proof. resetForAccountSwitch() immediately fences old work on a real logout/account switch and queues revocation; it is not deletion. Failed or unavailable proof preserves the valid guest. See the account guide before implementing this boundary.
Text, history and exact retry
SDK views manage openHelp(), refresh(), startConversation(subject:), openConversation(_:), loadOlderMessages(in:), send(_:in:), retry(_:) and draft(for:)/setDraft(_:for:). HTTP pages contain up to 50 public messages; private notes never enter the SDK. Text is bounded to 4,000 grapheme clusters and 65,536 UTF-8 bytes. Pending retries keep their original payload and request identity. discardPending(_:) is deliberate local discard, while cancelPendingSend(_:) pauses delivery without undoing an accepted message. Acknowledge display only for a visible reply; custom transcripts must cancel the task when it leaves the active viewport.
Photos and actions
LobbyPhotoPreparation.prepare(_:) emits oriented, metadata-stripped JPEG/PNG within 1 MiB and 2,048 pixels. send(_:in:photos:) is additive to the original text send. attachmentData(_:) uses current-session authorization; the standard UI includes picker, thumbnail and zoom viewer. Photos require private_photos_v1. support.actions.register accepts real LobbyScreen/LobbyPaywall handlers, at most 50/20 respectively, and requires registered_actions_v1 for synchronization/execution. A ticket/requested receipt precedes the handler; an uncertain callback never executes automatically again.
Host events, appearance and failures
onEvent is one optional main-actor callback, independent of SDK UI behavior. It reports visibility, canonical acceptance, fetch/display, identity/profile and action status using IDs, without message bodies or metadata values. LobbyTheme supports bounded accent/radius/team/welcome values, host locks and LobbyTypography. System/host fonts remain the default. Observe failure/profileFailure and actions.failure separately; LobbyFailure includes a safe request ID when supplied. clearFailure() dismisses a current error; it does not erase a pending request. Source and tested behavior remain authoritative for this unreleased version.