SDKs

Swift SDK

Official Swift client for the MUDBASE API (CocoaPods).

Installation

All 9 language SDKs live in one monorepo, one directory per language. Swift Package Manager cannot install a single package from a subdirectory of a monorepo, so the published package is distributed via CocoaPods instead — pointed directly at the podspec in the repo:

ruby
# Podfile
pod 'MudbaseSDK', :podspec => 'https://github.com/themudhaxk/mudbase-sdk/raw/main/swift/MudbaseSDK.podspec'
# Podfile
pod 'MudbaseSDK', :podspec => 'https://github.com/themudhaxk/mudbase-sdk/raw/main/swift/MudbaseSDK.podspec'

Using Swift Package Manager instead? Add a local path dependency to the swift/ directory of a checkout of the monorepo for now — a standalone SPM-installable mirror is planned.

Quick Start

Configure the shared MudbaseSDKAPIConfiguration and call the API classes you need — there is no unified client wrapper, each resource is its own *API type with static methods:

swift
import MudbaseSDK

MudbaseSDKAPIConfiguration.shared.basePath = "https://cloud.mudbase.dev"
MudbaseSDKAPIConfiguration.shared.customHeaders["X-API-Key"] =
    ProcessInfo.processInfo.environment["MUDBASE_API_KEY"]!

// Log in an end-user of your project
let session = try await AuthenticationAPI.loginUser(
    loginRequest: LoginRequest(email: "morgan.chen@northwind.dev", password: "hunter2"))

// List documents in a collection
let items = try await DataAPI.listData(projectId: projectId, collectionId: collectionId)
import MudbaseSDK

MudbaseSDKAPIConfiguration.shared.basePath = "https://cloud.mudbase.dev"
MudbaseSDKAPIConfiguration.shared.customHeaders["X-API-Key"] =
    ProcessInfo.processInfo.environment["MUDBASE_API_KEY"]!

// Log in an end-user of your project
let session = try await AuthenticationAPI.loginUser(
    loginRequest: LoginRequest(email: "morgan.chen@northwind.dev", password: "hunter2"))

// List documents in a collection
let items = try await DataAPI.listData(projectId: projectId, collectionId: collectionId)

More

For error handling, pagination, and other languages, see the SDKs Overview.