Swift / Objective-C API
For Apple platforms (iOS, macOS, tvOS, visionOS), the SDK exposes the same v3 call surface through the Switchboard class (SBSwitchboard in Objective-C; the swift_name("Switchboard") attribute bridges it).
Every Switchboard object — the SDK singleton ("switchboard"), engines, nodes, extensions — is identified by an object URI. The same handful of calls drives every object.
All calls return SBResult<T> with isSuccess, isError, value, and error. Snippets below use Swift method names.
Initialize SDK
Initializes the SDK with a config dictionary. Returns the SDK's object URI.
class func initialize(withConfig config: [String: Any]) -> SBResult<String>
let result = Switchboard.initialize(withConfig: [
"appID": "your-app-id",
"appSecret": "your-app-secret",
])
if result.isError {
print(result.error?.message ?? "unknown error")
}
Deinitialize SDK
Releases all SDK-owned resources.
class func deinitialize() -> SBResult<NSNull>
Switchboard.deinitialize()
Create Engine
Creates an engine from a config dictionary (or JSON string). Returns the engine's object ID.
class func createEngine(withConfig config: [String: Any]) -> SBResult<String>
class func createEngine(withJSON json: String) -> SBResult<String>
let createResult = Switchboard.createEngine(withConfig: engineConfig)
guard let engineID = createResult.value else { return }
Destroy Engine
Destroys an engine and everything it owns.
class func destroyEngine(withObjectID objectID: String) -> SBResult<NSNull>
Switchboard.destroyEngine(withObjectID: engineID)
Call Action
Invokes a named action on any Switchboard object.
class func callAction(
withObject objectURI: String,
actionName: String,
params: [String: Any]?
) -> SBResult<Any>
// Start the engine
Switchboard.callAction(withObject: engineID, actionName: "start", params: nil)
// Load a file into a player node
Switchboard.callAction(withObject: "playerNode", actionName: "load", params: [
"audioFilePath": "AudioFiles/speech-mono-48k.wav"
])
Set Value
Writes a value to a key on a Switchboard object.
class func setValue(_ value: Any, forKey key: String, onObject objectURI: String) -> SBResult<NSNull>
Switchboard.setValue(true, forKey: "isLoopingEnabled", onObject: "playerNode")
Switchboard.setValue(0.5, forKey: "gain", onObject: "gainNode")
Get Value
Reads a value from a key on a Switchboard object.
class func getValue(forKey key: String, object objectURI: String) -> SBResult<Any>
let framesResult = Switchboard.getValue(forKey: "framesRecorded", object: "recorderNode")
if framesResult.isSuccess, let frames = framesResult.value as? Int {
// ...
}
Add Event Listener
Subscribes to a named event. The callback receives a dictionary of event data. Returns a listener ID.
class func addEventListener(
_ objectURI: String,
eventName: String,
callback: @escaping ([AnyHashable: Any]) -> Void
) -> SBResult<NSNumber>
let listenerResult = Switchboard.addEventListener(
"playerNode",
eventName: "playbackProgress"
) { eventData in
// ...
}
let listenerID = listenerResult.value
Remove Event Listener
Unsubscribes a previously registered listener.
class func removeEventListener(_ objectURI: String, listenerID: NSNumber) -> SBResult<NSNull>
Switchboard.removeEventListener("playerNode", listenerID: listenerID)
Full Reference
Open Swift / Objective-C API Reference — every method and overload, with Obj-C selectors.