Files
insforge--insforge/docs/snippets/swift-sdk-installation.mdx
wehub-resource-sync 3a28426bf4
Lint and Format Check / lint-and-format (push) Failing after 0s
Check Migrations / Check for duplicate migration numbers (push) Failing after 1s
CI Pre-merge Check / CI Pre-merge Check (push) Failing after 2m17s
chore: import upstream snapshot with attribution
2026-07-13 12:23:40 +08:00

61 lines
1.5 KiB
Plaintext

Add InsForge to your Swift Package Manager dependencies:
```swift
dependencies: [
.package(url: "https://github.com/insforge/insforge-swift.git", from: "0.0.9")
]
```
```swift
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:
```swift
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:**
| Level | Description |
|-------|-------------|
| `.trace` | Most verbose, includes all internal details |
| `.debug` | Detailed information for debugging |
| `.info` | General operational information (default) |
| `.warning` | Warnings that don't prevent operation |
| `.error` | Errors that affect functionality |
| `.critical` | Critical failures |
**Log Destinations:**
| Destination | Description |
|-------------|-------------|
| `.console` | Standard output (print) |
| `.osLog` | Apple's unified logging system (recommended for iOS/macOS) |
| `.none` | Disable logging |
| `.custom` | Provide your own LogHandler factory |
<Note>
Use `.info` or `.error` in production to avoid exposing sensitive data in logs.
</Note>