Skip to content
QwryAI
Documentation
Pages

iOS SDK

Installation & Quickstart

Add the QwryAI iOS SDK to your app and get your first answer from your agent

This page takes you from an empty Xcode project to a streamed answer from your agent. You turn on the iOS SDK channel in the dashboard, add the Swift package, create a QwryClient and send a message.

Prerequisites

RequirementMinimum
iOS17.0
macOS14.0
Swift6.0
Xcode16
SwiftUINot required. The SDK works with UIKit, AppKit or any UI code.

Installation

The SDK ships as a Swift package, QwrySDK, with no dependencies.

  1. Open Add Package Dependencies

    In Xcode, choose File → Add Package Dependencies…

  2. Paste the repository URL
    Code
    https://github.com/qwryai/qwryai-ios-sdk.git
  3. Pick the version and target

    Choose Up to Next Major Version from 0.1.0, then add the QwrySDK library to your app target.

Then import it:

Swift
import QwrySDK

Quick Start

  1. Open the iOS SDK channel

    In the dashboard, open your agent and go to Channels. On the iOS SDK card, select Manage. You can also switch to it from the channel menu at the top of the Playground.

    Channels › iOS SDK
  2. Turn on Visibility

    Select the Overview tab and switch Visibility on. Visibility saves as soon as you change it, and from then on the agent accepts requests from the SDK. Overview also holds the model and instructions this channel uses; leave Sync with global instructions on to answer exactly as your other channels do.

    Visibility lets the SDK reach your agent.
  1. Copy your agent ID

    Open the Setup tab. Under Agent ID, select Copy. The same tab links to the SDK source and the iOS example app, and repeats the install and quick start code with your agent ID already filled in.

    Setup holds your agent ID and install code.
  2. Create a client
    Swift
    import QwrySDK
    
    let client = QwryClient(agentId: "YOUR_AGENT_ID")

    Create the client once and keep it: in a view model, an app-level dependency or a @State property. QwryClient is an actor, so you can share one client across your app. A new client starts anonymous, tied to a device ID that stays the same across launches. For the other initializer options, see the QwryClient reference.

  3. Send your first message
    Swift
    let response = try await client.send("Hello! What can you help me with?") { handlers in
        handlers.onTextDelta = { piece in
            // Runs for each piece of text as it arrives
            print(piece, terminator: "")
        }
    }
    
    print(response.message.text)
    print("Conversation: \(response.conversationId)")
    print("Credits used: \(response.credits)")

    See ChatResponse for every field on the response.

  4. Continue the conversation

    The client remembers the conversation the last answer belonged to, so the next send carries on where you left off:

    Swift
    let followUp = try await client.send("Tell me more")

    Call await client.newConversation() when you want the next message to start a fresh conversation. For a chat screen, use ConversationState, which also keeps the message list for you.

Next steps

Explore the documentation