The Metabind iOS SDK (Documentation Index
Fetch the complete documentation index at: https://docs.metabind.ai/llms.txt
Use this file to discover all available pages before exploring further.
metabind-apple) lets you render server-driven content in your Swift applications. Build dynamic experiences that update instantly without app store releases.
View on GitHub
metabind-apple — source code, issues, and releases.Requirements
| Requirement | Version |
|---|---|
| Xcode | 15.0 or later |
| iOS | 17.0 or later |
| macOS | 14.0 or later |
| Swift | 5.9 or later |
Installation
Add the Metabind SDK to your project using Swift Package Manager.- Xcode
- Package.swift
- Open your project in Xcode
- Go to File → Add Package Dependencies
- Enter the repository URL:
- Select the version and add to your target
Quick start
1. Initialize the client
Create aMetabindClient with your API credentials from the Metabind dashboard:
2. Display content
UseMetabindView to render content by its ID:
3. Handle actions
Listen for actions triggered by user interactions:Core concepts
MetabindClient
The client manages the connection to Metabind’s API and handles:- Authentication — API key validation and request signing
- Content fetching — GraphQL queries for content and components
- Real-time updates — WebSocket subscriptions for live content changes
- Caching — a local SQLite-backed cache of fetched content and components
MetabindClient exposes async fetchers — fetchContent(id:), fetchContents(typeId:limit:) — along with streamContent(id:) and subscribeToContent(id:) for cache-then-network and real-time streams.
MetabindView
MetabindView is the primary way to display content. It automatically:
- Fetches the content and its required components
- Renders the UI based on your design system
- Subscribes to real-time updates when
enableSubscriptionistrue - Handles loading and error states
Actions
Actions are events triggered by user interactions with your content. Handle them with theonMetabindAction modifier, which delivers a MetabindContentAction (a name and a props dictionary):
| Action | Description |
|---|---|
metabind.content | Navigate to another content page |
metabind.url | Open an external URL |
metabind.dismiss | Dismiss the current view |
| Custom actions | Your own defined actions |
Real-time updates
For live content, either passenableSubscription: true to MetabindView or subscribe directly. subscribeToContent(id:) opens a GraphQL WebSocket subscription and yields the content each time it changes in Metabind:
streamContent(id:).
Direct GraphQL access
BeyondMetabindView, MetabindClient exposes the underlying GraphQL operations directly, all following the same shape:
fetch*— a singleasyncrequest.stream*— anAsyncStreamthat yields cached data first, then network updates.subscribeTo*— a real-time WebSocket subscription (content only).
Navigation
For apps with multiple content pages, integrate with SwiftUI’s navigation system:Platform support
| Platform | Minimum Version |
|---|---|
| iOS | 17.0 |
| macOS | 14.0 |
Next steps
Sample app
See a complete example of the SDK in action.
Build components
Create custom components for your app.
BindJS reference
Learn the component authoring language.
Managing content
Understand how to structure content.