Dynamic runtime configuration

How to support dynamic runtime configuration

Utilising dynamic runtime configuration

You can use the platform's dynamic configuration for application settings that are loaded at runtime. You can also subscribe to changes in these settings. These may include styling options, metadata or feature toggling. Within Studio, these settings are found in the Project > Setup > Experience tab and are specified in your App Spec.

In order to use this capability, you will need to load the Project and obtain data from its fields as follows:

func loadProject() {
    // Interact will already be initialised at this stage
    Interact.defaultCore.getProject(completion: { [weak self] result in
        guard let self = self else { return }       
        do {
            self.display(project: try result.get())
        } catch {
            // Treat the error
        }
    })
}

func display(project: Project) {
    // You can use project fields in your UI by fetching them like so:
    let id = project.id
    let myField = project.fields["my_field"]
}

You can be notified of any update on the project by using this snippet:

Last updated