Current Config

Last Updated - Platform 23.0 - SDK 18.0

The AppSwitcher is used to select the current config if there are multiple environments within the config file. If there is only one config, or only one production config when not in developer mode, then this will be skipped.


After an environment is selected the config can be accessed using AppConfig.current?. Accessing the current config is thread-safe.

Custom Keys

If you want to toggle features or change configuration per environment then custom keys are perfect for this. Add the keys to the config file (ensuring they do not conflict with other keys) then access them using the settings property.

// Example feature flag.
let isFeatureEnabled = AppConfig.current?.settings["featureEnabled"] as? Bool ?? false

This is fine for the odd setting but it's not type-safe so a better option is to use subconfigs.


Subconfigs are strongly typed configs that are decoded from custom keys.

  1. Create a subconfig struct with matching key names and conform to AppSubconfig and Decodable.
struct CustomAppConfig: AppSubconfig, Decodable {
var featureEnabled: Bool?
  1. Use your config in the same way as the AppConfig.
// Improved example feature flag.
let configs = CustomAppConfig.current
let isFeatureEnabled = configs?.featureEnabled ?? false

Some poq integrations have custom keys and subconfigs such as the ApplePayConfig. Accessing current subconfigs shares the current config thread-safety.