跳转到主要内容
InsForge Swift SDK 为从 iOS、macOS、tvOS 和 watchOS 应用与 InsForge 服务交互提供了原生 Swift 客户端。

安装

Swift Package Manager

Add InsForge to your Swift Package Manager dependencies:

Enable Logging (Optional)

For debugging, you can configure the SDK log level and destination:
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.
或通过 Xcode 添加:
  1. File → Add Packages…
  2. 输入:https://github.com/insforge/insforge-swift.git

CocoaPods(即将推出)

快速入门

功能

  • 数据库 - 支持 Codable 的类型安全 CRUD 操作
  • 身份验证 - 电子邮件/密码和 OAuth 身份验证
  • 存储 - 文件上传、下载和管理
  • AI - 聊天完成和图像生成
  • 实时 - 基于 WebSocket 的发布/订阅消息
  • SwiftUI 集成 - 属性包装和环境值

平台支持

平台最低版本
iOS15.0+
macOS12.0+
tvOS15.0+
watchOS8.0+

SDK 参考

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