SpeechTilesAndamento Docs
Get started
SDK Reference · Method

runtimeField

Returns the current value of a named Conversation runtime field.

Declaration

public func runtimeField(_ name: String) -> Any?

Overview

Requires initialization. Before initialization, the method records .conversationNotInitialized and returns nil.

A nil result therefore does not by itself distinguish an unavailable field from a call made before initialization; applications should follow the documented lifecycle.

Conversation and Prompt Module configurations reference a runtime field using the expression $[FieldName]. For example, a field named CustomerName is referenced as $[CustomerName] in configuration text. The name inside the brackets must match the name used when setting or reading the runtime field.

Reading a field

Use the field name configured by the Conversation. The return type is Any?; safely cast to the expected application type rather than assuming the field exists or has a particular type.

Parameters

  • name — String The name identifying the field or resource.

Usage example

The corresponding conversation configuration can reference this value using $[CustomerName].

if let name = conversation.runtimeField("CustomerName") as? String {
    print(name)
}

See Also