PhoenixNectar is a Swift client for Phoenix Channels, built from the ground up for Swift 6 strict concurrency.
It builds on the great work of SwiftPhoenixClient by David Stump and Daniel Rees, which has been the go-to Swift client for years. PhoenixNectar takes a different approach by embracing Swift’s modern concurrency model (actors, async/await, and AsyncStream) rather than the JS-style callback API.
What it looks like
import PhoenixNectar
struct ChatMessage: Codable, Sendable {
let body: String
}
let client = try Socket(endpoint: "wss://api.example.com/socket")
try await client.connect()
let channel = try await client.joinChannel("room:lobby")
// Subscribe with AsyncStream
let posted = Event<ChatMessage>("message:posted")
for try await message in await channel.subscribe(to: posted) {
print(message.body)
}
// Typed push with reply
let send = Push<ChatMessage, ChatMessage>("message:send")
let reply = try await channel.push(send, payload: ChatMessage(body: "hello"))
print(reply.body)
Features
- Swift 6 strict concurrency — actor-owned runtime, no
@unchecked Sendableworkarounds Push<Request, Response>andEvent<T>for compile-time payload type safety- Auto reconnect, heartbeat, and channel rejoin
- Auth token providers that re-evaluate on each reconnect
- Connection state observation via
AsyncStream - Binary channel support
- iOS 16+, macOS 15+, tvOS 18+, watchOS 11+
Feedback welcome, especially from anyone running Phoenix Channels with iOS/macOS clients.
A demo project (demo iOS project with chat and image upload) and E2E tests are provided as well.






















