Skip to main content
The InsForge Swift SDK provides a native Swift client for interacting with InsForge services from iOS, macOS, tvOS, and watchOS applications.

Installation

Swift Package Manager

Add InsForge to your Swift Package Manager dependencies:
dependencies: [
    .package(url: "https://github.com/insforge/insforge-swift.git", from: "0.0.9")
]
import InsForge

let insforge = InsForgeClient(
    baseURL: URL(string: "https://your-app.insforge.app")!,
    anonKey: "your-anon-key"
)

Enable Logging (Optional)

For debugging, you can configure the SDK log level and destination:
let options = InsForgeClientOptions(
    global: .init(
        logLevel: .debug,
        logDestination: .osLog,
        logSubsystem: "com.example.MyApp"
    )
)

let insforge = InsForgeClient(
    baseURL: URL(string: "https://your-app.insforge.app")!,
    anonKey: "your-anon-key",
    options: options
)
Log Levels:
LevelDescription
.traceMost verbose, includes all internal details
.debugDetailed information for debugging
.infoGeneral operational information (default)
.warningWarnings that don’t prevent operation
.errorErrors that affect functionality
.criticalCritical failures
Log Destinations:
DestinationDescription
.consoleStandard output (print)
.osLogApple’s unified logging system (recommended for iOS/macOS)
.noneDisable logging
.customProvide your own LogHandler factory
Use .info or .error in production to avoid exposing sensitive data in logs.
Or add it via Xcode:
  1. File → Add Packages…
  2. Enter: https://github.com/insforge/insforge-swift.git

CocoaPods(coming soon)

pod 'InsForge', '~> 1.0'

Quick Start

import InsForge

let insforge = InsForgeClient(
    baseUrl: "https://your-app.insforge.app",
    anonKey: "your-anon-key"
)

Features

  • Database - Type-safe CRUD operations with Codable support
  • Authentication - Email/password and OAuth authentication
  • Storage - File upload, download, and management
  • AI - Chat completions and image generation
  • Realtime - WebSocket-based pub/sub messaging
  • SwiftUI Integration - Property wrappers and environment values

Platform Support

PlatformMinimum Version
iOS15.0+
macOS12.0+
tvOS15.0+
watchOS8.0+

SDK Reference

Database

CRUD operations with Codable models

Authentication

Sign up, sign in, OAuth, and user management

Storage

File upload, download, and management

AI

Chat completions and image generation

Realtime

WebSocket pub/sub messaging