1 min read

Developer Mode

Last Updated - Platform 25.0 - SDK 20.0

Developer Mode is a hidden flag introduced with the App Switcher and configs in v23.0.

Switching developer mode forces the user to restart the app to allow integrations to restart in their correct configurations.

Production

The app is in production mode by default (except in simulator). In production mode the app:

  • Present only production environments in the environment switcher.
  • Uses the default configs for integrations.

Developer Mode

The app is automatically set to developer mode when running in simulator. In developer mode the app:

  • Presents a toast on launch to let you know you are in developer mode.
  • Presents production and development environments in the environment switcher.
  • Adds a shortcut to the app to launch straight into the environment switcher (when stuck).
  • Uses development configs for integrations that are capable of switching configs.
  • Disables all integrations that are not capable of handling developer mode.
  • Enables additional debugging such as Firebase live event debugging.

Integrations

Integrations must explicitly support developer mode by setting their module's isEnabledInDeveloperMode flag to true.

It's common in the industry for 3rd party frameworks to be initialised on app launch against a single configuration. So, whilst integrations can support developer mode however they like, there are generally only a few approaches.

Force enabled in developer mode

This approach is dangerous for some integrations; specifically those with revenue tracking or where data is very important.

To follow this approach set the flag to true and do nothing else.

class CustomModule: PoqModule {
var isEnabledInDeveloperMode: Bool { true }
}

Integrations that do this will pollute their single configuration with test data; for an analytics provide, a tester could purchase fake products on a development environment and that revenue would mix with real purchases.

Disabled in developer mode

This approach follows on from the above but purposefully disables the integration when in developer mode.

This is the default approach and requires no code.

class CustomModule: PoqModule {
var isEnabledInDeveloperMode: Bool { false }
}

This completely avoids live data pollution but can cause confusion when testing if it's not clear that this integration will be disabled.

Switch configs in development mode

This approach is the best but is dependent on the integration.

Here you can use the Settings.isDeveloperMode flag to decide what config set to load on app launch.

class CustomModule: PoqModule {
var isEnabledInDeveloperMode: Bool { true }
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) {
CustomIntegration.launch(
options: launchOptions,
settings: .init(fromPlist: Settings.isDeveloperMode ? "development": "production")
)
}
}

The user is forced to relaunch the app when they toggle developer mode. This enables integration to 'restart' on app launch with the correct configuration.

Next steps