loadConversation (URL)
Loads a Conversation definition from a Conversation resource.
Declaration
public func loadConversation(from resource: String) -> STResultOverview
Requires an initialized, idle runner. The resource is resolved through the configured Conversation resource location and language/resource resolver. An unresolved resource returns .fileNotFound.
Loading and prerequisites
Load the Conversation definition from a resource resolvable through the configured local resource location. Initialize the runner and ensure the Conversation is idle before loading.
Parameters
- resource — String Refer to the method-specific behavior and usage example for how this parameter is used.
Usage example
_ = conversation.loadConversation(from: "Conversation_Main.json")
Result handling
This loading method executes synchronously. .success indicates that the requested resource data was loaded successfully. Handle other STResult values as loading failures.
Resource location
Before loading a resource file, you may configure the default local directory with STConversationRunner.setResourceLocation using .conversation from STResourceCategory.
By default, the language-specific directory is en-US. The loader first searches that language-specific directory under the configured resource location. If the resource is not found there, it searches the parent resource directory as a fallback. You can select another language-specific directory using STConversationRunner.setLanguageFolder.