Skip to main content

iOS - Access Module Invocation Data

note

Modules conforming to MethodModule or UIModule interfaces can access runtime invocation parameters via the ModuleInvocationData instance.

When a module is invoked from the Tecton layer or host application, it receives an instance of ModuleInvocationData containing key-value pairs passed at runtime.

Accessing Runtime Parameters​

Starting in Mobile SDK iOS 26.3.0, prefer the typed runtimeParamsData property. This exposes runtime parameters as [String: JSONValue].

Example​

Assume the module is invoked from a web context with the following JSON:

{
"server": "prod"
}

You can access the value in your module like this:

Accessing Runtime Parameter with JSONValue
let server = moduleInvocationData.runtimeParamsData["server"]?.stringValue

This allows your module to behave dynamically based on runtime data passed during invocation.

Working with JSONValue​

JSONValue is the typed representation used by Q2ModuleInterfaces for arbitrary JSON payloads.

Depending on the incoming value, you can read:

  • stringValue
  • intValue
  • doubleValue
  • boolValue
  • arrayValue
  • objectValue
  • isNull

Example:

Accessing Different JSONValue Types
let server = moduleInvocationData.runtimeParamsData["server"]?.stringValue
let retryCount = moduleInvocationData.runtimeParamsData["retryCount"]?.intValue
let flags = moduleInvocationData.runtimeParamsData["flags"]?.objectValue

Legacy Access​

note

The older runtimeParams property remains available for backward compatibility, but it is deprecated in favor of runtimeParamsData.

Deprecated Legacy Access
let server = moduleInvocationData.runtimeParams["server"] as? String