Skip to main content

iOS - Access Module Configuration

note

To enable a module to access configuration data at build time, specify the data node in settings.json located in your Q2DevApp. This configuration is also required when submitting a Mobile Module Deployment request.

Each module entry in settings.json includes an optional data field, which can be used to pass custom configuration. This configuration is parsed and made available to the module at runtime.

Example configuration in settings.json:

Module Configuration in settings.json
{
"name": "q2-demo-ios",
"packageName": "q2-demo-ios",
"productName": "Q2Demo",
"className": "Q2DemoModule",
"identifier": "com.q2.mobile.module.demo",
"data": "{\"key\": \"value\"}",
"enabled": true
}
tip

In production, configuration values like apiKey will vary per financial institution (FI) and must be included in your deployment request.

Access Configuration in Your Module

Modules conforming to the Module protocol can access build-time configuration using the moduleDataSource.

Starting in Mobile SDK iOS 26.3.0, prefer the typed data property on ModuleBuildConfig. This exposes configuration values as [String: JSONValue].

Accessing Configuration with JSONValue

Access Typed Build Configuration
let value = moduleDataSource?.buildConfig.data["key"]?.stringValue

Accessing Configuration as a Raw String

Access as Raw String
let configString = moduleDataSource?.buildConfig.dataString

Legacy Access

note

The older dataDictionary property remains available for backward compatibility, but it is deprecated in favor of the typed data property.

Deprecated Legacy Access
let value = moduleDataSource?.buildConfig.dataDictionary["key"] as? String

This allows the module to dynamically read configuration values passed in by the host application at build time.