SDKs

Swift SDK

Official Swift client for the MUDBASE API (Swift Package Manager or CocoaPods).

Installation

The Swift SDK is mirrored to its own standalone repo (not a subdirectory of a larger monorepo), so it installs directly via Swift Package Manager:

swift
.package(url: "https://github.com/themudhaxk/mudbase-sdk-swift", from: "1.3.12")
.package(url: "https://github.com/themudhaxk/mudbase-sdk-swift", from: "1.3.12")

Prefer CocoaPods? Point the podspec directly at the repo:

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

Quick Start

Set the shared MudbaseSDKAPI configuration and call the API classes you need - there is no unified client wrapper, each resource is its own *API type with static methods that take a completion handler (there is no async/await variant yet):

swift
import MudbaseSDK

MudbaseSDKAPI.basePath = "https://cloud.mudbase.dev"

// Log in an end-user of your project
AuthenticationAPI.loginUser(loginRequest: LoginRequest(email: "morgan.chen@northwind.dev", password: "hunter2")) { session, error in
    guard let token = session?.token else { return }

    // Use the returned JWT for subsequent authenticated calls
    MudbaseSDKAPI.customHeaders["Authorization"] = "Bearer \(token)"

    // List documents in a collection
    DataAPI.listData(projectId: projectId, collectionId: collectionId) { items, error in
        // handle items
    }
}
import MudbaseSDK

MudbaseSDKAPI.basePath = "https://cloud.mudbase.dev"

// Log in an end-user of your project
AuthenticationAPI.loginUser(loginRequest: LoginRequest(email: "morgan.chen@northwind.dev", password: "hunter2")) { session, error in
    guard let token = session?.token else { return }

    // Use the returned JWT for subsequent authenticated calls
    MudbaseSDKAPI.customHeaders["Authorization"] = "Bearer \(token)"

    // List documents in a collection
    DataAPI.listData(projectId: projectId, collectionId: collectionId) { items, error in
        // handle items
    }
}

More

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

Chat with us