Contents

ctrl-hub/sdk.swift

An SDK for interacting with the Ctrl Hub API in Swift

Installation

Add the package with your package manager using https://github.com/ctrl-hub/sdk.swift

Then import the package into your bundle:

import CtrlHub

Getting Started

The SDK uses a .plist configuration file called CtrlHubConfig.plist to collect all of the variables required to connect to the platform which you should add to to the root of your own project when integrating the SDK.


<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>authDomain</key>
    <string>https://auth.ctrl-hub.com</string>
    <key>apiDomain</key>
    <string>https://api.ctrl-hub.com</string>
</dict>
</plist>

To use the SDK, you need to import the package before calling any methods:

import CtrlHub

// Read the configuration from the CtrlHubConfig.plist in your app bundle:
if let configuration = CtrlHub.Config() {
    CtrlHub.config = configuration
} else {
    // there are errors in the config file
}

// Make requests to Ctrl Hub via the SDK:
do {
    let orgs = try await CtrlHub.Organisations.shared.Get()
} catch let error as CtrlHub.APIError {
    // handle the error
}

Package Metadata

Repository: ctrl-hub/sdk.swift

Homepage: https://docs.ctrl-hub.com/sdk/swift

Stars: 0

Forks: 0

Open issues: 0

Default branch: main

Primary language: swift

License: MIT

Topics: sdk, sdk-ios, swift

README: README.md