Skip to Content
Swift SDKGuidesEnvironment Variables

Environment Variables

Override configuration at runtime — useful for switching between demo configs and CI/CD.

Xcode Setup

Edit Scheme → Run → Environment Variables

VariableValuesDescription
VIO_CONFIG_TYPEviaplay, tv2, automaticLoads vio-config-<type>.json
VIO_ENVIRONMENTproduction, development, sandboxOverride environment
VIO_USER_COUNTRYNO, SE, DK, GBOverride market country check

Multi-Config Setup

Useful for demoing multiple clients (Viaplay, TV2) from the same codebase:

App Bundle ├── vio-config-viaplay.json → VIO_CONFIG_TYPE=viaplay ├── vio-config-tv2.json → VIO_CONFIG_TYPE=tv2 └── vio-config.json → default (no variable needed)

Config Priority

  1. VIO_CONFIG_TYPE environment variable → loads vio-config-<type>.json
  2. vio-config.json (no variable)
  3. vio-config-automatic.json
  4. vio-config-example.json
  5. SDK defaults

Load from Environment Programmatically

// Reads VIO_API_KEY, VIO_ENVIRONMENT, VIO_CONFIG_TYPE from ProcessInfo ConfigurationLoader.loadFromEnvironment()

Country Override

// Load config, then check market availability for Norway ConfigurationLoader.loadConfiguration(userCountryCode: "NO")

Combined with VIO_USER_COUNTRY in the scheme, useful for testing market availability without changing code.

Next Steps

Last updated on