Swift Client (swift-client)
swift-client generates Swift models and an async URLSession-based client.
Generate
xrpc generate --input src/contract.ts --targets swift-client
Generated files in xrpc/:
Types.swiftClient.swift
Runtime notes
- Uses
Codablemodels. - Uses async request APIs.
- Validation metadata from Zod is preserved where representable in generated types.
Typical usage
let client = XRPCClient(baseURL: URL(string: "https://api.example.com/rpc")!)
let output = try await client.userGetUser(.init(id: "123"))
print(output.name)